Clarification:
(I changed the name of the server and IPs in the following code)
$mail = new phpmailer;
$mail->IsSMTP(); // set mailer to use SMTP
$mail->From = "email@example.com";
$mail->FromName = "example.com";
$mail->Host = "mail.example.com"; // specify main and backup server
$mail->SMTPSecure = 'ssl';
$mail->SMTPDebug = 1;
$mail->Port = 465; // set the SMTP port for the server
$mail->SMTPAuth = true;
$mail->Username = "user";
$mail->Password = "password";
$mail->CharSet = 'ISO-8859-1'; // so it interprets foreign characters
$mail->AddAddress("otheremail@example.com", "Other");
$mail->AddReplyTo("email@example.com", "example.com");
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the message body";
$mail->Send(); // send message
With the above settings, when set to Port 465, PHPMailer give me these errors:
SMTP -> ERROR: HELO not accepted from server:
SMTP -> NOTICE: EOF caught while checking if connected
mail.log give me:
postfix/smtpd[8089]: warning: TLS library problem: 8089:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol:s23_srvr.c:578:
When I change the port to 587, I get:
SMTP -> ERROR: MAIL not accepted from server: 530 5.7.0 Must issue a STARTTLS command first
SMTP -> ERROR: RCPT not accepted from server: 530 5.7.0 Must issue a STARTTLS command first
SMTP -> ERROR: RCPT not accepted from server: 530 5.7.0 Must issue a STARTTLS command first
SMTP -> ERROR: DATA command not accepted from server: 530 5.7.0 Must issue a STARTTLS command first
mail.log:
postfix/smtpd[8380]: connect from example.com[ip.ip.ip.ip]
postfix/smtpd[8380]: disconnect from example.com[ip.ip.ip.ip]