Hello All,
I want to send email when my users got registered in my site.
Am using visualstudio 2010 and IIS7
I refered many links in DOTNETFUNDA too, but there was no error yet the mail is not sent. MailRoot folger is empty.no other error message in code.
My Code
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
MailMessage mail = new MailMessage();
mail.From = new MailAddress("diamondloga@gmail.com");
mail.To.Add("mynameiskutima@gmail.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
SmtpServer.Port = 25;
SmtpServer.Credentials = new System.Net.NetworkCredential("ecommerce", "ecommerce");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail); In web.config:
<system.net>
<mailSettings>
<smtp >
<network host="localhost" port="25" />
</smtp>
</mailSettings>
</system.net>
am using IIS7 and i have installed smtp server and have assigned its properties too.Please guide me whether am wrong ? or how to send mail?