Monday, March 26, 2012

SMTP send e-mail

I know there are lots of threads covering my question but i am still unable
to send e-mails from an asp.net page. Messages are not even going into the
logs.
Here is the code that i am using to send the e-mail.
MailMessage objMail = new MailMessage();
objMail.From = "nigel@dotnet.itags.org.***";
objMail.To = nigel@dotnet.itags.org.***;
objMail.Subject = txtSubject.Text;
objMail.BodyFormat = MailFormat.Html;
objMail.Body = "Text"
SmtpMail.SmtpServer = "127.0.0.1";
SmtpMail.Send(objMail);
The error that i am getting is
System.Runtime.InteropServices.COMException: The message could not be sent
to the SMTP server. The transport error code was 0x800ccc15. The server
response was not available
Line 22: SmtpMail.Send(objMail);
The server is a Windows 2003 running iis 6.0 and smtp. I have set the realy
to 127.0.0.1 but to no avail.
One thing that i have noticed is that i cannot telnet to port 25. I have no
firewall enabled yet and no antivirus.
Does anyone have any suggestions?
Thanks in advance
NigelI would hazard a guess that your expecting your smtp instance to handle your
email - but your local SMTP is not an SMTP gateway, only a forwarding device
to a gateway like an Exchange server or ISP email server on port 25. That
would explain why you cant get a response from port 25.
Cant remember the exact details - but you need to try setting the smart host
option of your smtp under IIS to point to an accesible smtp server.
Regards
John Timney
Microsoft MVP
"Nigel" <Nigel@.discussions.microsoft.com> wrote in message
news:62B5A8ED-12A4-4D43-BD5D-2524E52E9ADA@.microsoft.com...
>I know there are lots of threads covering my question but i am still unable
> to send e-mails from an asp.net page. Messages are not even going into the
> logs.
> Here is the code that i am using to send the e-mail.
> MailMessage objMail = new MailMessage();
> objMail.From = "nigel@.***";
> objMail.To = nigel@.***;
> objMail.Subject = txtSubject.Text;
> objMail.BodyFormat = MailFormat.Html;
> objMail.Body = "Text"
> SmtpMail.SmtpServer = "127.0.0.1";
> SmtpMail.Send(objMail);
> The error that i am getting is
> System.Runtime.InteropServices.COMException: The message could not be sent
> to the SMTP server. The transport error code was 0x800ccc15. The server
> response was not available
> Line 22: SmtpMail.Send(objMail);
> The server is a Windows 2003 running iis 6.0 and smtp. I have set the
> realy
> to 127.0.0.1 but to no avail.
> One thing that i have noticed is that i cannot telnet to port 25. I have
> no
> firewall enabled yet and no antivirus.
> Does anyone have any suggestions?
> Thanks in advance
> Nigel

0 comments:

Post a Comment