2016-07-23 6 views
1

Ich weiß vielleicht meine Frage ist etwas seltsam, aber ich möchte E-Mail von asp.net Web-Projekt an meine registrierten Kunden senden. Ich kann dies einfach mit Google Mail tun. aber ich möchte es von Parallels Webmail senden. mein C# -Code ist wie folgt:
Parallels Webmail Ausgabe

using (MailMessage mm = new MailMessage("[email protected]", email)) 
      { 
       mm.Subject = "Account Activation"; 
       string body = "Hello " + name.Trim(); 
       mm.Body = body; 
       mm.IsBodyHtml = true; 
       SmtpClient smtp = new SmtpClient(); 
       smtp.Host = "mydomain.com"; 
       smtp.EnableSsl = true; 
       NetworkCredential NetworkCred = new NetworkCredential("[email protected]", "mypassword"); 
       smtp.UseDefaultCredentials = true; 
       smtp.Credentials = NetworkCred; 
       smtp.Port = 26;//587 is also tested 
       smtp.Send(mm); 
     } 

Aber ich bekomme Fehler "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.63.251.194:26"

Ich bin sicher, dass ich nicht richtig smtp.host Format senden können. Auch hier
dies nur für E-Mail-Client auf paralles enter image description here
Der Screenshot Fehlermeldung ist Einstellung: enter image description here

Alle Kommentare sind willkommen.

Antwort

1

Verwenden Port 25 und smtp.EnableSsl = true;

using (MailMessage mm = new MailMessage("[email protected]", email)) 
{ 
    mm.Subject = "Account Activation"; 
    string body = "Hello " + name.Trim(); 
    mm.Body = body; 
    mm.IsBodyHtml = true; 
    SmtpClient smtp = new SmtpClient(); 
    smtp.EnableSsl = false; 
    smtp.Host = "mydomain.com"; 
    NetworkCredential NetworkCred = new NetworkCredential("[email protected]", "mypassword"); 
    smtp.UseDefaultCredentials = true; 
    smtp.Credentials = NetworkCred; 
    smtp.Port = 25; 
    smtp.Send(mm); 
} 
+0

Port 25 senden Sie mir niedrig sichere Verbindung Fehler machen –

+0

@RezaPaidar entfernen 'smtp.EnableSsl = true;' und versuchen – Mostafiz

+0

mich wieder senden „Server unterstützt keine sichere Verbindungen. " –

Verwandte Themen