Why am I getting this smtp exception error? it used to work fine on the dev machine, but on the server I get that smtp error when trying to send mail.
any help?
help please, I use the following code:
MailMessage msg = new MailMessage("mail@mail.com", "mail@mail.com");
Smtp smtp = new Smtp(); smtp.Host = "mail.mail.com"; smtp.Port = 25; msg.Subject = "Contacto"; msg.Body = "Este e-mail usa HTML"; string style = "<style>body, html {scrollbar-face-color: #9cbaa9;scrollbar-arrow-color: #ffffff;scrollbar-highlight-color: #e4ede8;scrollbar-darkshadow-color: #789283;scrollbar-shadow-color: #8ea99a;}.infotable{background-color:#e4ede8;padding:0px;margin:0px;}.Vseparator{background-color:#FFFFFF;height:2px;}.darkgreenTextbold{padding:5px;color:#336666;font-weight:bold;font-size:12px;}td{font-size:12px;}</style>";
string strBody = "<html><head>"+style+"</head><body><br /><br />\n"; strBody+="<table width=\"70%\" align=\"center\" class=\"infotable\">\n"; strBody+="<tr><td colspan=\"2\" class=\"darkgreenTextbold\">CONTACTO</td></tr>\n"; strBody+="<tr><td class=\"Vseparator\" colspan=\"2\"></td></tr>\n"; strBody+="<tr><td width=\"80\" class=\"darkgreenTextbold\">Nombre</td><td align=\"left\">"+Nombre.Text+"</td></tr>\n"; strBody+="<tr><td class=\"darkgreenTextbold\">Empresa</td><td align=\"left\">"+Empresa.Text+"</td></tr>\n"; strBody+="<tr><td class=\"darkgreenTextbold\">Teléfono</td><td align=\"left\">"+Telefono.Text+"</td></tr>\n"; strBody+="<tr><td class=\"darkgreenTextbold\">E-mail</td><td align=\"left\">"+EmailAdr.Text+"</td></tr>\n"; strBody+="<tr><td class=\"darkgreenTextbold\">Comentario</td><td align=\"left\">"+Comentario.Text+"</td></tr>\n"; strBody+="</table>"; strBody+="</body></html>";
msg.HtmlBody=strBody; msg.Charset = "ISO-8859-1"; msg.Priority = MailPriority.Normal;
smtp.Username = "mail@mail.com"; smtp.Password = "pass"; smtp.SendMail(msg);
Response 334 is about you needing to Auth login to the SMTP connection
well, nevermind, I used dotnetopenmail instead and it worked fine on the first attempt.
Log in to post a comment.
Why am I getting this smtp exception error? it used to work fine on the dev machine, but on the server I get that smtp error when trying to send mail.
any help?
help please, I use the following code:
MailMessage msg = new MailMessage("mail@mail.com", "mail@mail.com");
Smtp smtp = new Smtp();
smtp.Host = "mail.mail.com";
smtp.Port = 25;
msg.Subject = "Contacto";
msg.Body = "Este e-mail usa HTML";
string style = "<style>body, html {scrollbar-face-color: #9cbaa9;scrollbar-arrow-color: #ffffff;scrollbar-highlight-color: #e4ede8;scrollbar-darkshadow-color: #789283;scrollbar-shadow-color: #8ea99a;}.infotable{background-color:#e4ede8;padding:0px;margin:0px;}.Vseparator{background-color:#FFFFFF;height:2px;}.darkgreenTextbold{padding:5px;color:#336666;font-weight:bold;font-size:12px;}td{font-size:12px;}</style>";
string strBody = "<html><head>"+style+"</head><body><br /><br />\n";
strBody+="<table width=\"70%\" align=\"center\" class=\"infotable\">\n";
strBody+="<tr><td colspan=\"2\" class=\"darkgreenTextbold\">CONTACTO</td></tr>\n";
strBody+="<tr><td class=\"Vseparator\" colspan=\"2\"></td></tr>\n";
strBody+="<tr><td width=\"80\" class=\"darkgreenTextbold\">Nombre</td><td align=\"left\">"+Nombre.Text+"</td></tr>\n";
strBody+="<tr><td class=\"darkgreenTextbold\">Empresa</td><td align=\"left\">"+Empresa.Text+"</td></tr>\n";
strBody+="<tr><td class=\"darkgreenTextbold\">Teléfono</td><td align=\"left\">"+Telefono.Text+"</td></tr>\n";
strBody+="<tr><td class=\"darkgreenTextbold\">E-mail</td><td align=\"left\">"+EmailAdr.Text+"</td></tr>\n";
strBody+="<tr><td class=\"darkgreenTextbold\">Comentario</td><td align=\"left\">"+Comentario.Text+"</td></tr>\n";
strBody+="</table>";
strBody+="</body></html>";
msg.HtmlBody=strBody;
msg.Charset = "ISO-8859-1";
msg.Priority = MailPriority.Normal;
smtp.Username = "mail@mail.com";
smtp.Password = "pass";
smtp.SendMail(msg);
Response 334 is about you needing to Auth login to the SMTP connection
well, nevermind, I used dotnetopenmail instead and it worked fine on the first attempt.