Failure sending mail

Discussion in 'Email' started by saravan, Nov 15, 2010.

  1. Hi,
    I have tried to send mail as mentioned in the Winhost article, [i used smtpclient and port no 587 and <trust level="Full" />]. But it throws "Failure sending mail".
    Guide me to proceed further. The following is the code i used,

    MailMessage mail = new MailMessage();
    mail.From = new MailAddress("[email protected]");
    mail.To.Add("[email protected]");
    mail.Subject = "Info from FYT";
    string str_Mailbody = "";
    str_Mailbody += "";
    mail.IsBodyHtml = true;
    mail.Body = str_Mailbody;
    SmtpClient smtp = new SmtpClient("mail.findyourtrees.com", 587);
    NetworkCredential Credentials = new NetworkCredential("[email protected]", "xxxxx");
    smtp.Credentials = Credentials;
    try
    {
    smtp.Send(mail);
    Response.Write("mail sent");
    }
    catch (Exception ex)
    {
    Response.Write(ex.Message);
    }
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    I checked your account and findyourtrees.com is not pointing or using Winhost email servers. You are using google's email server. You will need to contact them and ask them what is the best method to connect to their email server using ASP.Net remotely. Remember each email servers is setup differently. The kb article you are referring to is designed for Winhost email server not Google's.
     
    Last edited by a moderator: Oct 14, 2015
  3. Thanks ray

    Thanks for your help ray... i will proceed further with your suggestion..
     
  4. how to send mail to emails not hosted in my domain?

    I need to send mails which are not hosted in findyourtrees, how to proceed. I used the following code
    MailMessage mail = new MailMessage();
    mail.From = "[email protected]";
    mail.To = "[email protected]";
    mail.Subject = "Info from FYT";

    string str_Mailbody = "";

    str_Mailbody += "test mail";

    mail.BodyFormat = MailFormat.Html;

    mail.Body = str_Mailbody;

    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "587");
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2");
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "[email protected]");
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xxxxxx");

    SmtpMail.SmtpServer = "mail.findyourtrees.com";

    try
    {
    SmtpMail.Send(mail);
    Response.Write("mail sent");
    }
    catch (Exception ex)
    {
    Response.Write(ex.Message);
    }

    It throws me "The transport failed to connect to the server. " error.

    I googled this issue and one of the forum suggested me to check "The gateways are closed for the website in mail settings". How to proceed with this?
     
  5. Ray

    Ray

    mail.findyourtrees.com is pointing to googles email server. Have you contacted Google to see what requirements they need so you can send through their smtp server?

    Try looking at this link.

    http://forums.aspfree.com/asp-development-5/send-a-simple-email-using-cdo-gmail-account-279098.html

    Also check with Google if they require some kind of encrypted connection to their SMTP server. I believe they may require some kind of encrypted authentication such as TLS. If they do you may want to use the the common ASP.Net class system.net.mail to send out email since its easier to code for TLS.
     

Share This Page