Send Email in ASP.net

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!
 
R

Rakesh Vikram

A

Arne Vajhøj

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top