I have tested this code on a different SMTP server and it worked fine, but it doesn't work with the smtp server listed on my discountASP.NET hosting account. Anyone know if I have to do anything special? domainnamefromdiscountasp is replaced by the domain name obviously :-D
Thanks wisemx, I'm gonna check it out. Anyway I don't think that that empty string is generating the error. Its only used in the body string...
I have these two methods, one works perfect but the other thst is almost the same is throwing me "No such user here". I really can't tell why if the other method works fine on the server. Here's the code: public static string SendCustomerMail(string name, string from, string to, string body) { string emailStatus; mMail = new MailMessage(); mMail.From = new MailAddress("[email protected]", "TusProfes"); mMail.To.Add(to); mMail.IsBodyHtml = true; mMail.Subject = "contacto TusProfes:"; mMail.Body = "<html><p>Estimado Profesor:</p><p>Has recibido un correo de " + name + "(" + from + "), quien dice: " + body + "</p></html>"; try { SmtpClient sClient = new SmtpClient("localhost"); sClient.Send(mMail); emailStatus="El correo ha sido enviado satisfactoriamente."; } catch (Exception e) { emailStatus = "Ha ocurrido un error en el envĀ”o: "+e.Message; } return emailStatus; } Can anyone help me?