No such user here at System.Net.Mail.

Discussion in 'Site Programming, Development and Design' started by rudolflamprecht, Apr 19, 2010.

  1. Hi, i'm sending mail dynamically from my web application, but the following error is generated:

    The server response was: No such user here at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)

    I am using SMTP Authentication with SMTP Port 587, but with no success.

    Any idea what might be the problem?

    Thanks,
    Rudolf
     
  2. Ray

    Ray

    I don't have enough information to troubleshoot this problem. Give me a copy of your code (make sure you replace your email passwords with asteriks *****) and send me a link where I can see the error message on my browser.
     
  3. Thanks Ray, find the code below. The smtpserver, username and password is set in the .config file.

    string SiteAdminEmail = ConfigurationManager.AppSettings["SiteAdministratorEmailAddress"];
    if (SiteAdminEmail != string.Empty)
    {
    MailAddress ToEmailAddress = new MailAddress(tmpEmailAddress, "*****");
    string ToName = "******";
    MailAddress FromEmailAddress = new MailAddress(SiteAdminEmail, "*****");
    string FromName = "******";
    string MailSubject = "******";
    string MessageBody = "******";

    //[Instantiate Template Mail Class]
    SavantTemplateMailer AppMail = new SavantTemplateMailer();
    AppMail.From = FromEmailAddress;
    AppMail.FromName = FromName;
    AppMail.To.Add(ToEmailAddress);
    AppMail.Subject = MailSubject;
    AppMail.IsBodyHtml = true;
    //[Load Template from XSL File]
    AppMail.MailXSLForm = Request.PhysicalApplicationPath + "/XSLMailTemplates/PasswordRequest.xsl";
    //[Add XSL Parameters]
    AppMail.AddToken("DATETIMEREF", DateTime.Now.ToString());
    AppMail.AddToken("MESSAGEBODY", MessageBody);
    //[Generate Mail Message Body]
    AppMail.GenerateMailBody();
    AppMail.SMTPServerName = System.Configuration.ConfigurationSettings.AppSettings["SMTPServer"];
    AppMail.SMTPUserName = System.Configuration.ConfigurationSettings.AppSettings["SMTPUserName"];
    AppMail.SMTPUserPassword = System.Configuration.ConfigurationSettings.AppSettings["SMTPUserPassword"];
    AppMail.SMTPServerPort = 587;
    AppMail.Send();
    Response.Write(AppMail.ErrorMessage + AppMail.ErrorStackTrace);
    MailSendBool = true;
    }


    The URL is as follows: http://heartwoo.w02.Winhost.com/forgotpassword.aspx

    Thanks
     
    Last edited by a moderator: Oct 14, 2015
  4. Ray

    Ray

    I don't think you are passing the values correctly to these variables.


    AppMail.SMTPServerName = System.Configuration.ConfigurationSettings.AppSett ings["SMTPServer"];
    AppMail.SMTPUserName = System.Configuration.ConfigurationSettings.AppSett ings["SMTPUserName"];
    AppMail.SMTPUserPassword = System.Configuration.ConfigurationSettings.AppSett ings["SMTPUserPassword"];

    Try creating a simple test script. Use this kb article as an example.

    http://support.Winhost.com/KB/a650/how-to-send-email-in-aspnet.aspx
     
    Last edited by a moderator: Oct 14, 2015

Share This Page