I am having a problem while sending mails through code.Actually the code is running perfectly that there is no error,but mails are not reaching to the user whom i am sending.I am pasting my code below. Please check it and tell me the problem.
System.Net.Mail.MailMessage msgMail = new System.Net.Mail.MailMessage();
msgMail.From = new System.Net.Mail.MailAddress("veerab@orbees.com");
msgMail.To.Add(new System.Net.Mail.MailAddress("abhi.orbees@gmail.com"));
string currentuseremail = web.CurrentUser.Email.ToString();
msgMail.Subject = "Request:Joing into the myitem.Title.ToString()";
msgMail.IsBodyHtml = true;
string strBody = "test mail";
msgMail.Body = strBody;
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
client.Send(msgMail);
and i configured web.config as:
<system.net>
<mailSettings>
<smtp deliveryMethod="PickupDirectoryFromIis">
<network host="smtpout.secureserver.net" port="25" defaultCredentials="true"/>
</smtp>
</mailSettings>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true"/>
</settings>
</system.net>
I believe SMTP on the machine running IIS is not configured properly or it is not running at all. You might be able to see the emails you have sent in one of the Inetpub subfolder.
Id you set PickupDirectoryFromIis, it means local SMTP server will pickup these up and relay to another SMTP.