Thursday, February 5, 2009

Sending emails using System.Net.Mail

While using
SmtpClient sm = new SmtpClient("localhost")
for sending mails, the system shows error
'Cannot send mail'.

However, this problem comes only in .net 2.0 One reason for this is the McAfee antivirus!!! To solve the problem. Go to the Virusscan Console -> Select Properties and in the 'Port Blocking' tab, uncheck the 'Prevent mass mailing worms from sending email' option.

If after this, you get a message, cannot relay to 'address', then enable Relaying for your SMTP server.

No comments:

Post a Comment