Email sending works locally but not on a remote server

Asked

Viewed 1,692 times

3

I have a problem sending email using a server I created in a data center hired.

Email sending works locally normally, although SMTP is in a well-known hosting company (I saw that they allow 20 emails per day from international IP). I have tried using other email services and always works local.

$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = $host;
$mail->SMTPAuth = true;
$mail->Username = $user;
$mail->Password = $password;
$mail->Port = 587;
$mail->SMTPDebug  = 2; 
//$mail->SMTPSecure = 'tls';
$mail->From = $from_mail;
$mail->FromName = $from_name;
$mail->addAddress($to);

$mail->WordWrap = 50;                                 
$mail->isHTML(true);                               

$mail->Subject = $subject;
$mail->Body    = $message;

if(!$mail->send()) {
  echo 'Message could not be sent.';
  echo 'Mailer Error: ' . $mail->ErrorInfo;
  exit;
}

Does anyone have any idea what it might be?

The return whenever I try to send on the remote server is

2014-01-19 17:04:52 smtp error: failed to connect to server: Connection timed out (110) SMTP connect() failed. Message could not be sent. Mailer Error: SMTP connect() failed.

  • 1

    @Victor and so on. This can be discussed here http://meta.answall.com/questions/o-que-fazer-com-questions-que-podem-lookingdevelopment-mas-se-revealing. and the fact that we don’t have Servefault doesn’t mean we should accept his questions. If you think we should, you can propose in http://meta.answall.com/questions/264/quais-assuntos-devem-fazer-parte-do-nosso-foco-on-topic

1 answer

6


Your provider is preventing SMTP on your server / hosting, open a support ticket and ask about the release.

It is a common practice among hosting providers/servers to keep SMTP traffic blocked to prevent customers from sending SPAM.

Some do not release such access on more basic plans, even upon request.

  • I imagined that it was this, but I think it is some configuration that I have to release, anyway they do not offer support in this sense, the server is not managed.

  • No, it is not you who releases or not such configuration, it is who manages your hosting / server.

  • i have root access.

  • 2

    @Daniellemes Even with root access, the lock can be in the Firewall of the server [physical]. Or maybe it needs to create a endpoint for port X (I had this problem in the past with an Azure server). That is, even the [server instance] not being managed, the problem may be external to him...

  • @Daniellemes you may have better luck installing and configuring an email server on the server you control.

Browser other questions tagged

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