/ Published in: C#

For both gmail and gApps, use smtp.gmail.com on port 25 with SSL and NetworkCredentials.
Neither can send email to their own address, but they can send to other addresses.
NLog has an example of how to automatically send emails in order to log info from an app.
Expand |
Embed | Plain Text
string host = "smtp.gmail.com"; int port; //port = 587; // with TLS //port = 465; // with SSL port = 25; // normal - works for my gmail account with enableSSL { Subject = "subject", Body = "body", }; EnableSsl = true, Timeout = 30000, }; try { smtp.Send(message); } catch(SmtpException se) { //log } message.Dispose();
You need to login to post a comment.