Send Email in ASP.net

  • Thread starter Thread starter Muhammad Deeraf
  • Start date Start date
M

Muhammad Deeraf

I am using following code to send an email to a gmail account.

MailMessage mm = new MailMessage("(e-mail address removed)","(e-mail address removed)","Subject: be careful","hi target, you are going to miss the train");
NetworkCredential nc = new NetworkCredential("(e-mail address removed)","myaccountpassword","http://www.gmail.com");
SmtpClient sc = new SmtpClient("smtp.gmail.com",587);
sc.Credential = nc;
sc.Send(mm);


The above code doesn't raise any exception but take along time at last line, and when i check target account inbox, there is no email.

Please help!
 
Muhammad said:
I am using following code to send an email to a gmail account.

MailMessage mm = new MailMessage("(e-mail address removed)","(e-mail address removed)","Subject: be careful","hi target, you are going to miss the train");
NetworkCredential nc = new NetworkCredential("(e-mail address removed)","myaccountpassword","http://www.gmail.com");
SmtpClient sc = new SmtpClient("smtp.gmail.com",587);
sc.Credential = nc;
sc.Send(mm);


The above code doesn't raise any exception but take along time at last line, and when i check target account inbox, there is no email.

Usually sending mail with no exceptions but no mail received is due to
the mail being catched in some spam filter.

Arne
 
Back
Top