Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We have a daily custom timer job that emails a newsletter. Recently newsletters have not been sent and the timer job status has been stuck on "initialized 0%"

I have cleared the cache as described in this article - http://blogs.msdn.com/b/josrod/archive/2007/12/12/clear-the-sharepoint-configuration-cache-for-timer-job-and-psconfig-errors.aspx

However when the job next runs it goes back to "initialized 0%"

The logs are showing messages such as:

The operation has timed out. at System.Net.Mail.SmtpClient.Send(MailMessage message)

I have confirmed that we are using the correct smtp settings for the outbound smtp server and that subscriber email addresses are being pulled through in the code correctly.

What is strange is that the newsletter is still being received by one recipient, who is using an email address with our company domain.

Is there anything else I can check in SharePoint (2007) or is this an exchange / SMTP issue?

Thanks very much

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

"What is strange is that the newsletter is still being received by one recipient, who is using an email address with our company domain."

Are some of the email addresses outside your domain? SMTP Servers can have different rules for what they will do with internal and external addresses.

I would start by using an SMTP Test tool (you can also use telnet) to verify that you can send emails through your smtp server to internal and external addresses

http://www.simplecomtools.com/productcart/pc/viewPrd.asp?idproduct=5&idcategory=5

You may also want to consider installing a local SMTP server on your SharePoint server (such as IIS SMTP service), getting SharePoint to send to that and then relaying email from the local server to you main server.

share|improve this answer
    
Thanks @Ryan, yep all the other email addresses are external apart from the one that is getting through. I'll give your SMTP test suggestion a go... –  junkrig May 10 '12 at 7:47
    
It was a problem with exchange 2010 unable to relay to external mail addresses, telnet showed '550 5.7.1 Unable to relay'. Fixing this fixed the SharePoint timer job problem. Thanks @Ryan –  junkrig May 14 '12 at 7:30
add comment

Try this solution for Sending mail using SMTP.

  MailMessage mailMessage = new MailMessage(new MailAddress("From@gmail.com"), new MailAddress("TO@gmail.com"));
            mailMessage.Subject = "HI";
            mailMessage.IsBodyHtml = true;
            mailMessage.Body = "<h2>Message</h2>";
            System.Net.NetworkCredential networkCredentials = new System.Net.NetworkCredential("From@gmail.com", "PassWord");
            SmtpClient smtpClient = new SmtpClient();
            smtpClient.EnableSsl = true;
            smtpClient.UseDefaultCredentials = false;
            smtpClient.Credentials = networkCredentials;
            smtpClient.Host = "smtp.gmail.com";
            smtpClient.Port = 587;
            ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
            smtpClient.Send(mailMessage);

Main thing in this code is

            ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
share|improve this answer
    
Why -1 vote Please comment on this so i can improve my ans –  Vishal_Sharepoint May 11 '12 at 5:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.