E-mail sending C # The remote name could not be resolved

0

I'm testing the application's email sending for a password recovery option, I tested it several ways, including email from another domain and hosting, and everything works fine, I tested it with email from gmail and everything works fine , more with the server's email does not work.

I have an example of a C # code that works perfectly with another server and works with gmail, but it does not work with TOP3, thanks for the help.

 public void EnviarEmailComSenhaAcesso()
        {
            string nome = "NOME DO CONTATO";
            string EmailContato = "[email protected]";
            string mensagem = "Mensagem";
            string login = "este e o seu login";
            string senha = "está e sua senha";

            //usando o google funciona
         //   string sUserName = "[email protected]";
          //  string sPassword = "";
            string sBobdy = "";

            //usando o servidor multiplique
            string sUserName = "[email protected]";
            string sPassword = "SENHA";


            MailMessage objEmail = new MailMessage();
            objEmail.From = new MailAddress(sUserName.Trim());
            objEmail.To.Add(new MailAddress(EmailContato, "Senha de Acesso ao site"));
            objEmail.Subject = "Recupera Senha Acesso";

            sBobdy = "Mensagem do site:\n\n" +
                                    "Nome: " + nome + "\n" +
                                    "Email: " + EmailContato + "\n" +
                                    "Login: " + login + "\n" +
                                    "Senha: " + senha + "\n" +
                                    "Mensagem: " + mensagem + "\n\n";
            objEmail.Body = sBobdy;

          //  SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587 /* TLS */);
            SmtpClient smtp = new SmtpClient("smtp.multiplick.com", 25 /* TLS */);
            smtp.EnableSsl = true;
            smtp.Credentials = new NetworkCredential(sUserName, sPassword, "");
            try
            {
                smtp.Send(objEmail);
                TempData["msg-contato"] = "A sua senha de acesso foi enviada para o seu e-mail cadastrado!";
            }
            catch (Exception ex)
            {
                // TempData["msg-contato-erro"] = "Ops..houve um problema com o envio do e - mail!Você pode tentar no telefone!";
                TempData["msg-contato-erro"] = ex.Message;
            }
        }

I get the error when using the server:

    
asked by anonymous 19.08.2017 / 05:09

2 answers

0

I do not have an exact solution, but I believe it will resolve the doubt. A few months ago I had the same problem you're having, I use the GoDaddy service with SMTP: relay-hosting.secureserver.net I searched 99% of the sites and could not find a solution until I called there and they basically informed me ( and tightly nut):

  

Our SMTP only works if it is on our servers. Shared hosting has limitations.

Because I believe my problem was the same as yours:

  • I had the same Exception.
  • Exception occurred at localhost .
  • When I set up a different email service (Google) it works on localhost normally.
  • This item is likely to happen (if you want to test and edit the question even better), when I use the service in the out of localhost ) it would not return the Exception.
  • I could not find the error DIRECTLY related to SMTP that you use, but I found #

      

    I have contacted Go Daddy about this, and have been told that the host network will not work when running localhost, as I suspected.

         

    I contacted Go Daddy, and they said that the email server (I could not understand the literal translation) will not work on Localhost as I suspected.

    What I advise at the moment is: Or you call the service and probably the support will say the same as the support of Go Daddy said to me, or take the evidence for yourself upa the site in the Hosting and test the sending the problem is in what was quoted in the reply.

        
    19.08.2017 / 05:52
    0

    Querying with nslookup , host smtp.multiplick.com did not appear as the domain MX. In a reverse lookup, the PTR for this host was not found. The MX of the domain I found was mail.multiplick.com .

    Switch to your code and try again:

    SmtpClient smtp = new SmtpClient("mail.multiplick.com", 25);
    

    Or

    SmtpClient smtp = new SmtpClient("mail.multiplick.com", 587);
    
        
    30.08.2017 / 14:08