Need help sending email

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 28
Reputation: SiPexTBC is an unknown quantity at this point 
Solved Threads: 0
SiPexTBC SiPexTBC is offline Offline
Light Poster

Need help sending email

 
0
  #1
Oct 22nd, 2007
I'm trying to send an email from my contact form using gmail, but i get a runtime error when try to send it.

Heres the code:

  1. MailMessage email = new MailMessage();
  2. email.From = new MailAddress(from);
  3. email.To.Add(new MailAddress(to));
  4. email.Subject = subject;
  5. email.Body = body;
  6. email.IsBodyHtml = false;
  7. System.Net.NetworkCredential auth = new System.Net.NetworkCredential("username", "password");
  8. System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
  9. smtp.EnableSsl = true;
  10. smtp.UseDefaultCredentials = false;
  11. smtp.Credentials = auth;
  12. smtp.Send(email);

Any help would be appreciated!

Thanks

SiPex
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Need help sending email

 
0
  #2
Oct 23rd, 2007
change "smtp.gmail.com", 587" to "smtp.gmail.com", 465" and it should work.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 28
Reputation: SiPexTBC is an unknown quantity at this point 
Solved Threads: 0
SiPexTBC SiPexTBC is offline Offline
Light Poster

Re: Need help sending email

 
0
  #3
Oct 23rd, 2007
still getting

Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Need help sending email

 
0
  #4
Oct 23rd, 2007
well add the custom errors message they ask you to do to your web.config file. this way we can see what your error really is!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC