Quantcast
Viewing all articles
Browse latest Browse all 26542

Problem sending email

Hi

Windows 2008 Server R2/IIS 7.0.

I am using below code to send email;

Dim objMailMsg As New MailMessage(strFrom, strTo)
objMailMsg.BodyEncoding = Encoding.UTF8
objMailMsg.Subject = strSubject
objMailMsg.Body = strMsg
objMailMsg.Priority = MailPriority.High
objMailMsg.IsBodyHtml = True

Dim SmtpMail As New SmtpClient
SmtpMail.Host = "localhost"
SmtpMail.Port = 25
SmtpMail.DeliveryMethod = SmtpDeliveryMethod.Network

SmtpMail.Send(objMailMsg)

However I get a ‘Unable to connect to the remote server’ exception on line SmtpMail.Send(objMailMsg).

When I do;

telnet localhost 25

I get;

Could not open connection to the host, on port 25: Connect failed.

What can I do to send the email please?

Thanks

Regards


Viewing all articles
Browse latest Browse all 26542

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>