SMTP Issues

#1

Hello I am trying to send emails through SMTP emails using php mailer. Here is my code. It worked before coming to cloudflare. I have attached my email dns records. I have also tried putting the origin servers IP as the host.

<?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; //Load Composer's autoloader require 'vendor/autoload.php'; $mail = new PHPMailer(true); try { //Server settings $mail->SMTPDebug = 2; $mail->isSMTP(); $mail->Host = 'mail.tickytimer.com'; $mail->SMTPAuth = true; $mail->Username = 'usernamegoeshere'; $mail->Password = 'passwordgoeshere'; $mail->SMTPSecure = 'tls'; $mail->Port = 587; //Recipients $mail->setFrom('fromemailgoeshere', 'TickyTimer'); $mail->addAddress('toemailgoeshere'); $mail->addReplyTo('replyemailgoeshere'); //Content $mail->IsHTML(true); $mail->Subject = 'Testing Email Server'; $mail->Body = '

Hello

'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; } ?>

I get the following response.
2019-04-04 17:56:23 CLIENT -> SERVER: STARTTLS
2019-04-04 17:56:23 SERVER -> CLIENT: 220 TLS go ahead
SMTP Error: Could not connect to SMTP host.
2019-04-04 17:56:23 CLIENT -> SERVER: QUIT
2019-04-04 17:56:23
2019-04-04 17:56:23
SMTP Error: Could not connect to SMTP host.
Message could not be sent. Mailer Error: SMTP Error: Could not connect to SMTP

0 Likes

#2

If you have SSH access to the server, could you tell the output of this command:

dig mail.tickytimer.com
1 Like

#3

Check your local or servers DNS cache. A dig Like @Judge mentioned will show If it’s resolving correctly. Additionally check your firewall settings if there’s outgoing traffic blocked to port 25

telnet mail.tickytimer.com 25 Trying 198.xx.xx.xx…
Connected to mail.tickytimer.com.
Escape character is ‘^]’.
220-ecbiz173.inmotionhosting.com ESMTP Exim 4.91 #1 Thu, 04 Apr 2019 16:14:07 -0400
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
helo test.de
250 ecbiz173.inmotionhostinghosting.com Hello test.de [62.xx.xx.xx]
rset
250 Reset OK
quit
221 ecbiz173.inmotionhosting.com closing connection
Connection closed by foreign host

0 Likes