Problem on sending email using yahoo RRS feed

  • Question

  • Hello

    I am going to send the email using yahoo account.

    Here is my code.

    System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage("myaccount@yahoo.com", "toaddress, "Test", "Test");


            System.Net.Mail.SmtpClient emailClient = new System.Net.Mail.SmtpClient();

            emailClient.Host = "smtp.mail.yahoo.com";        

            emailClient.Credentials = new System.Net.NetworkCredential("myaccount@yahoo.com", "mypassword");

            emailClient.Port = 465;

            emailClient.EnableSsl = true;


    (I didn't write my real yahoo account & password.)

    When I run this code, I get the error message 'An existing connection was forcibly closed by the remote host'.

    Do you know why it is?

    I have no problem when to set the port to 25 and set to the ssl to 'false'.

    Please help me!


    thanks in advice.

    • Moved by Rudedog2 Sunday, February 13, 2011 4:44 PM . 3rd party web sites are off topic . (From:Visual C# General)
    Sunday, February 13, 2011 11:11 AM

All replies

  • use  emailClient.Port = 587;

    and make

    emailClient.EnableSsl = false;

    hope it will work now.



    you can check following links




    waiting for response.




    Hasibul Haque, MCTS http://blog.e-rains.com
    Sunday, February 13, 2011 11:43 AM
  • Yahoo mail server behavior is off-topic in these forums.
    Mark the best replies as answers. "Fooling computers since 1971."


    • Proposed as answer by Rudedog2 Sunday, February 13, 2011 12:14 PM
    Sunday, February 13, 2011 12:13 PM
  • Thanks for your reply.

    But I need to set the EnableSsl to 'true'.

    Because sometimes the email sent with no ssl, is considered as a spam.


    Sunday, February 13, 2011 4:31 PM
  • please check following link


    you have to download EASendMail20.dll from there then do following


    SmtpMail oMail = new SmtpMail("TryIt");
          SmtpClient oSmtp = new SmtpClient();
          //Your yahoo email address
          oMail.From = "myid@yahoo.com";
          //Set recipient email address
          oMail.To = "support@emailarchitect.net";
          //Set email subject
          oMail.Subject = "test email from yahoo account";
          //Set email body
          oMail.TextBody = "this is a test email sent from c# project with yahoo.";
          //Yahoo SMTP server address
          SmtpServer oServer = new SmtpServer("smtp.mail.yahoo.com");
          //yahoo user authentication should use your 
          //yahoo email address without domain part as the user name. 
          //For example: your email is "myid@yahoo.com", then the user should be "myid"
          oServer.User = "myid";
          oServer.Password = "yourpassword";
          //Because yahoo deploys SMTP server on 465 port with direct SSL connection.
          //So we should change the port to 465.
          oServer.Port = 465;
          //Send email over SSL/TLS connection.
          oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;
            Console.WriteLine("start to send email over SSL ...");
            oSmtp.SendMail(oServer, oMail);
            Console.WriteLine("email was sent successfully!");
          catch (Exception ep)
            Console.WriteLine("failed to send email with the following error:");

    Hope it will solve your problem.


    Hasibul Haque, MCTS http://blog.e-rains.com
    Monday, February 14, 2011 3:55 AM