Error trying to send email

Asked

Viewed 2,001 times

1

I am trying to send emails (using my Hotmail account) and am encountering the error below: inserir a descrição da imagem aqui

A connection attempt failed because the connected component does not replied r ncorretamente after a period of time or connection established failed to nporque the connected host did not respond 65.55.176.126:25

The method I’m using is below:

public void sendEMailThroughHotMail()
        {
            try
            {
                //Mail Message
                MailMessage mM = new MailMessage();

                //Mail Address
                mM.From = new MailAddress("[email protected]");

                //receiver email id
                mM.To.Add("[email protected]");

                //subject of the email
                mM.Subject = "your subject line will go here";

                //add the body of the email
                mM.Body = "Body of the email";

                mM.IsBodyHtml = true;

                //SMTP client
                SmtpClient sC = new SmtpClient("smtp.live.com");

                //port number for Hot mail
                sC.Port = 25;

                //credentials to login in to hotmail account
                sC.Credentials = new NetworkCredential("[email protected]", "xxxxxx");

                //enabled SSL
                sC.EnableSsl = true;

                //Send an email
                sC.Send(mM);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

I also tried sending via gmail, but Google interpreted my sending attempt as an attack attempt

  • Have you tried using door 465?

  • @Hiagosouza tried it now, and the error presented is exactly the same: "An attempt at connection failed because the connected component did not respond to a match after a period of time or the established connection failed to host the connected host did not respond 65.55.163.152:465"

3 answers

2


First log into your Webmail and enable POP/IMAP on Hotmail the configuration is in: options / Connect devices and apps with POP then on the same screen has the link Other ways to connect to your inbox where you will have the settings you need to use (address, port, ssl, tls).

To the e-mail of Gmail, It is also necessary to enable the use of POP/IMAP and also has a security configuration that also needs to be released, only I can’t remember the way now. Also has the help page with the access configuration information.

2

When trying to send the email at port 25 you cannot have SSL active.

The door 25 was closed by providers in Brazil, I don’t know if that could be a problem.

But to solve your problem make use of SSL on port 465.

Example

public void sendEMailThroughHotMail()
        {
            try
            {
                //Mail Message
                MailMessage mM = new MailMessage();

                //Mail Address
                mM.From = new MailAddress("[email protected]");

                //receiver email id
                mM.To.Add("[email protected]");

                //subject of the email
                mM.Subject = "your subject line will go here";

                //add the body of the email
                mM.Body = "Body of the email";

                mM.IsBodyHtml = true;

                //SMTP client
                SmtpClient sC = new SmtpClient("smtp.live.com");

                //port number for Hot mail
                sC.Port = 465;

                //credentials to login in to hotmail account
                sC.Credentials = new NetworkCredential("[email protected]", "xxxxxx");

                //enabled SSL
                sC.EnableSsl = true;

                //Send an email
                sC.Send(mM);

            }
  • I tried it now, and the error presented is exactly the same: "A connection attempt failed because the connected component did not respond to a match after a period of time or the established connection failed to host the connected host did not respond 65.55.163.152:465"

  • @Gleisoconfidence, enable tel net and try to connect on port 465. telnet 65.55.163.152 465 can be blocking your firewall because there is nothing else wrong. Disable windows firewall and try again. If this is the case, disable Antivirus as it is not a programming error. You simply cannot reach the target host.

  • Are you in the company or at home? If you are in the company check if you have IP access at port 465, sometimes it’s just the rssss firewall

  • I hadn’t thought about it. Not really how to access the company. The thing is, I tried the same house code last night and got the same error. But I’m gonna try that door from home tonight. Thanks for the force!

  • 1

    Try to disable the firewall, sometimes there is some blocking.. Telnet helps in these cases

1

Hello try like this.

  protected void Page_Load(object sender, EventArgs e)
        {
            StringBuilder Body = new StringBuilder();
            Body.Append("Aqui vai meu teste vamos ver se chega!!!!! :)");


            String HostSmtp = "smtp.live.com";
            String LoginSmtp = "[email protected]";
            String PasswordSmtp = "xxxxx";
            Int32 PortaSmtp = 587;

            SmtpClient Smtp = new SmtpClient(HostSmtp, PortaSmtp);
            Smtp.UseDefaultCredentials = true;
            Smtp.EnableSsl = true;

            Smtp.Credentials = new NetworkCredential(LoginSmtp, PasswordSmtp);

            MailMessage mail = new MailMessage();
            mail.IsBodyHtml = true;
            mail.SubjectEncoding = System.Text.Encoding.UTF8;

            mail.From = new MailAddress("[email protected]");
            mail.To.Add(new MailAddress("[email protected]"));

            mail.Subject = "Teste de envio de email";
            mail.Body = Body.ToString();

            var Status = String.Empty;
            try
            {
                Smtp.Send(mail);
                Status = "Ok";
            }
            catch (Exception exc)
            {
                Status = exc.Message;
            }
        }

inserir a descrição da imagem aqui

see the link here

Browser other questions tagged

You are not signed in. Login or sign up in order to post.