Hi,

I am attempted to use .NET's SMTPClient to send e-mail. I get no error messages or exceptions, yet the e-mail does not get sent. I have set the SMTPClient.DeliveryMethod to PickupDirectoryFromIis because I was getting an error message of Mailbox unavailable before. Now I no longer get that error message or any other.

The result is the same whether I test it from my testing computer or deployed on the actual web server. No error messages, and no mail is actually sent. On my testing computer the mail gets sent to C:\Inetpub\mailroot\Badmail and I am not sure why.

GoDaddy is the host for the website if that makes any difference. I don't care if I get it to work on my test machine, but it is crucial to get it to actually work on GoDaddy's server where the site is hosted.

Any help is greatly appreciated.

using System.Net.Mail;
...

//Set up smtp client
SmtpClient smtpClient = new SmtpClient();        
smtpClient.Host = "localhost";
smtpClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
smtpClient.Port = 25;

//Set up message
MailMessage msg = new MailMessage();
msg.From = new MailAddress("test@test.com");
msg.To.Add(new MailAddress("test@test.com"));
msg.IsBodyHtml = false;               
msg.Priority = MailPriority.Normal;      
msg.Subject = "--";
msg.Body = "--"

//Send the e-mail
smtpClient.Send(msg);

Try this

MailMessage m = new MailMessage();
            m.From = new MailAddress("frommailaddress", "sender");
            m.To.Add("toemailaddress");
            m.Subject = "Web Exception" + (httpErrorCode == null ? string.Empty : " HTTP ERROR: " + ((int)httpErrorCode).ToString("F0"));
            m.Body = lastError.Message + Environment.NewLine + Environment.NewLine +
              lastError.StackTrace;
            SmtpClient smtp = new SmtpClient("SMTPservername");
            smtp.Credentials = new NetworkCredential("username", "passowrd");
            smtp.Send(m);