P
Patrick
Environment: Windows 2000 Server SP4, IIS5.0, Dot Net Framework 1.1
Situation:
A Console application that send an email using System.Web.Mail.MailMessage
Observation:
1) Recently, the application is failing to deliver messages!
2) Even when eMails was delivered, there are no entries logged in the SMTP
Log files!
3) I have carried out the following test
3.1) On the Win2K Server where the mail console app is installed, I have
configured Outlook Express to try to send mail using SMTP Server
theServerName, and mail is delivered successfully, with
3.1.1) SMTP Log logging Outlook Express communicating with the IIS Virtual
SMTP Server
3.1.2) SMTP Virtual Server logging relaying the message to external SMTP
Server.
Settings on IIS Virtual SMTP Server
1) Access- Only the list below (127.0.0.1 + the server's IP address)
2) Relay- Only the list below (127.0.0.1 + the server's IP address)- Allow
all computers which successfully authenticate to relay, regardless of the
list above
3) Authentication- Anonymous Access, Basic authentication, Windows Security
package
Default settings for every thing else
Code Snippet-
using System.Web.Mail;
using System.Diagnostics;
[STAThread]
static void Main(string[] args)
{
Class1 cls = new Class1();
cls.createFile();
}
public void createEmail(string sFilePath)
{
// Note this method is explicitly not handling exception. The calling
method should handle it and log to event viewer
MailMessage mail = new MailMessage();
mail.From = sSalesEmail;
mail.To = sExportEmail;
mail.Subject = "Daily order email";
mail.BodyFormat = MailFormat.Text;
MailAttachment attachement = new MailAttachment(sFilePath);
mail.Attachments.Add(attachement);
SmtpMail.Send(mail);
}
public void createFile()
{
try
{
createEmail(strFilePath); //Create the email and send
}
catch(Exception ex)
{
Logging.LogError("Emailer",ex.ToString());
}
}
My biggest biggest concern now is nothing is logged when mail is sent, so I
cannot figure out where the problem lies! How could I fix this? Note that
there are nothing in the bad mail, queued, etc. directory for the email
which should have been sent but haven't.
I have also made one additional interestin observation!
1) Stop SMTP Virtual server on IIS
2) Run the emailing console app
3) Nothing logged in Event Viewer to indicate failure/exceptions in
SmtpMail.Send(mail)
4) Start IIS SMTP Virtual Server
5) Mail relayed successfully (but still nothing logged in SMTP Log file)
Situation:
A Console application that send an email using System.Web.Mail.MailMessage
Observation:
1) Recently, the application is failing to deliver messages!
2) Even when eMails was delivered, there are no entries logged in the SMTP
Log files!
3) I have carried out the following test
3.1) On the Win2K Server where the mail console app is installed, I have
configured Outlook Express to try to send mail using SMTP Server
theServerName, and mail is delivered successfully, with
3.1.1) SMTP Log logging Outlook Express communicating with the IIS Virtual
SMTP Server
3.1.2) SMTP Virtual Server logging relaying the message to external SMTP
Server.
Settings on IIS Virtual SMTP Server
1) Access- Only the list below (127.0.0.1 + the server's IP address)
2) Relay- Only the list below (127.0.0.1 + the server's IP address)- Allow
all computers which successfully authenticate to relay, regardless of the
list above
3) Authentication- Anonymous Access, Basic authentication, Windows Security
package
Default settings for every thing else
Code Snippet-
using System.Web.Mail;
using System.Diagnostics;
[STAThread]
static void Main(string[] args)
{
Class1 cls = new Class1();
cls.createFile();
}
public void createEmail(string sFilePath)
{
// Note this method is explicitly not handling exception. The calling
method should handle it and log to event viewer
MailMessage mail = new MailMessage();
mail.From = sSalesEmail;
mail.To = sExportEmail;
mail.Subject = "Daily order email";
mail.BodyFormat = MailFormat.Text;
MailAttachment attachement = new MailAttachment(sFilePath);
mail.Attachments.Add(attachement);
SmtpMail.Send(mail);
}
public void createFile()
{
try
{
createEmail(strFilePath); //Create the email and send
}
catch(Exception ex)
{
Logging.LogError("Emailer",ex.ToString());
}
}
My biggest biggest concern now is nothing is logged when mail is sent, so I
cannot figure out where the problem lies! How could I fix this? Note that
there are nothing in the bad mail, queued, etc. directory for the email
which should have been sent but haven't.
I have also made one additional interestin observation!
1) Stop SMTP Virtual server on IIS
2) Run the emailing console app
3) Nothing logged in Event Viewer to indicate failure/exceptions in
SmtpMail.Send(mail)
4) Start IIS SMTP Virtual Server
5) Mail relayed successfully (but still nothing logged in SMTP Log file)