Wednesday, April 13, 2011

SharePoint 2007 Alert Mail Issue

SharePoint 2007 Alert Mail Issue



I came across an issue today related to alert mail not getting delivered whenever I modify or create a task item. Initially I was not getting the alert creation email as well. Following are the steps followed
Step 1.

Check whether the SMTP server is working. Below is a simple code to verify the service is working or not.
using System;
using System.Net.Mail;
public class Program
{
public static void Main(string[] args)
{
try
{
// Check arguments
if (args.Length != 3)
{
Show();
return;
}

// Create message
MailMessage mmMessage = new MailMessage();
mmMessage.To.Add(new MailAddress(args[2] as string));
mmMessage.From = new MailAddress(args[1] as string);
mmMessage.Subject = "TestMail";
mmMessage.Body = "This is a test";

// Send message
SmtpClient sc = new SmtpClient(args[0] as string);
sc.Send(mmMessage);

}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

private static void Show()
{
Console.WriteLine("TestMail [SmtpServer] [FromAddress] [ToAddress]");
}

}
Save the file as SMTPTest.cs
Open the Visual Studio command prompt and execute the below
>csc.exe /out:SMTPTest.exe SMTPTest.cs
>SMTPTest.exe [SMTP Server IP address][FromAddress][ToAddress]
If you receive a mail then the SMTP servvice is working fine.

Step 2.

Open the Central Administration – Operation -> Topology and Services -> Outgoing e-mail settings
Enter the outbound SMTP server address and the other details. Click OK.
Verify if the email alerts are going.

Step 3.

Open the Central Administration ->Application Management -> Web application outgoing e-mail settings
Select the web application and verify the outbound smtp server.
Verify if the email alerts are going.

Step 4.

Check out the stsadm command in the below link to verify if the alerts are enabled.
http://sharepointalert.info/
Verify if the email alerts are going.

Step 5.

Check the Windows SharePoint Services Timer Service, if it is started. If the service is not started then start the services.
Verify if the email alerts are going.
Please reset IIS if the alerts mails are not going.

No comments:

Post a Comment