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
 

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

Similar Threads

Email... HELP 1
Gmail SMTP 3
Failure to Send email 1
Help Please-- Failure sending Email 1
Sending Email 2
Email Not Set 3
Trying to send an email 7
C# - Email problems 2

Back
Top