Nugs
asked on
System.Web.Mail class - please explain...
Ok i am having a few issues with some STMP code we have in production. I have narrowed these issues down to (among other things) McAfee...
Anywho..... that is not what i am posting about...
As i am testing, when i disable McAfee and directly connect to the exchange server like so:
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------
public static void SendMail(string from, string recipients, string subject, string body)
{
MailMessage mail = new MailMessage();
mail.To = recipients;
mail.From = from;
mail.Subject = subject;
mail.Body = body;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); SmtpMail.SmtpServer = "XX.XX.XX.XXX";
SmtpMail.Send(mail);
}
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------
... my email gets set and all is good...
My issue is that most of the mail code in production do NOT use this class and instead (i guess) uses default setting. Here is the code in production:
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------
MailMessage mail = new MailMessage();
mail.To = "you@you.com";
mail.From = "me@me.com";
mail.Subject = "Mail Subject"
mail.Body = "Mail body"
SmtpMail.Send(mail);
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------
This i assume uses the default SMTp server setup on the local web server that it is running from... Right?
If that is the case then why is it that when i stop the IIS SMTP server this code still sends out mail... What SMTP server is it using to send the mail if the local is disabled?
To clarify, what i need to knwo is what is the default for the mail class when no SMTP server is specified.
:: Nugs ::
Anywho..... that is not what i am posting about...
As i am testing, when i disable McAfee and directly connect to the exchange server like so:
--------------------------
public static void SendMail(string from, string recipients, string subject, string body)
{
MailMessage mail = new MailMessage();
mail.To = recipients;
mail.From = from;
mail.Subject = subject;
mail.Body = body;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); SmtpMail.SmtpServer = "XX.XX.XX.XXX";
SmtpMail.Send(mail);
}
--------------------------
... my email gets set and all is good...
My issue is that most of the mail code in production do NOT use this class and instead (i guess) uses default setting. Here is the code in production:
--------------------------
MailMessage mail = new MailMessage();
mail.To = "you@you.com";
mail.From = "me@me.com";
mail.Subject = "Mail Subject"
mail.Body = "Mail body"
SmtpMail.Send(mail);
--------------------------
This i assume uses the default SMTp server setup on the local web server that it is running from... Right?
If that is the case then why is it that when i stop the IIS SMTP server this code still sends out mail... What SMTP server is it using to send the mail if the local is disabled?
To clarify, what i need to knwo is what is the default for the mail class when no SMTP server is specified.
:: Nugs ::
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Oh i was just informed that the web server is not even on the same subnet as our network (it has an external IP obviousley) so it can not be finding the Esxchange server via AD...
:: Nugs ::
:: Nugs ::
ASKER
It was using my localhost SMTp, apparently stoping the SMTP server in IIS does not stop the SMTP service. Stopping the service stoped outbound mail.
Interesting about the AD stuff thought, thanks for your input.
:: Nugs ::
Interesting about the AD stuff thought, thanks for your input.
:: Nugs ::
ASKER
:: Nugs ::