Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A very similar situation happened to me a while back. I followed templates I had found on line for using SmtpClient in System.Net. After researching I found out that my ISP had policies in place to drop mail traffic on certain ports because they wanted people to route traffic through their own mailservers (combat spam).</p> <p>My situation was complicated by the fact that the port I needed to use (for my business ymail account) were blocked by my ISP. Turns out the only mailservers I could ever connect to was gmail. So you might try using different mail providers, or talking to your ISP about mail drop/block policies and how certain ports are treated.</p> <p>Here's what worked for me:</p> <pre><code>private bool sendEmailAlert(string emailAddress, string subject, string message) { try { //Construct e-mail message: string fromAddress = "you@somedomain.com", fromName = "Your Biz";//"Don't Reply"; MailMessage email_msg = new MailMessage(); email_msg.From = new MailAddress(fromAddress, fromName); email_msg.Sender = new MailAddress(fromAddress, fromName); email_msg.To.Add(emailAddress); email_msg.Subject = subject; email_msg.Body = message; SmtpClient mail_client = new SmtpClient(); NetworkCredential network_cdr = new NetworkCredential(); network_cdr.UserName = "you@somedomain.com"; network_cdr.Password = "password"; mail_client.Credentials = network_cdr; mail_client.Port = 587; mail_client.Host = "smtp.gmail.com"; mail_client.EnableSsl = true; //Send e-mail message; mail_client.Send(email_msg); return true; } catch (Exception ex) { StreamWriter errorFile = new StreamWriter("errorLog.txt", true); errorFile.WriteLine(DateTime.Now.ToString() + ": sendEmailAlert exception: " + ex.ToString()); errorFile.Close(); return false; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload