Thursday, November 23, 2006

.NET 2.0 SmtpClient and IIS

In .NET 2.0 using System.Net.Mail to send mail we do following:

Create object of MailMessage
Provide value for
Create object of SmtpClient
Assign Host
Assign Port
Call send() method

Using above simple steps, one can sent email using .NET System.Net.Mail library.
On other side, if using IIS as SMTP server, we need to have the same host address in allow list of SMTP server as we have provided in smtpClient object.

I was working on sending mail and it my application was not able to send mail as I have defined Host as in application and in SMTP server in allow list the IP was (actual IP of my machine). And system was unable to send mail. All the time I was getting exception kinda saying “mailbox unavailable”

1 comment: