PHP 메일 프로그램

PHP 메일 프로그램

웹 애플리케이션의 모든 알림 이메일 등을 처리하기 위해 자체 SMTP 서버(메일 보내기만)를 설정하고 싶습니다.

dpkg-reconfigure exim4-config

Type:                   internet site
FQDN:                   smtp.mydomain.com
SMTP listener:          127.0.0.1; ::1
Mail destinations:      Debian-Buster10; localhost
Relay:                  (empty)
Follow up screen relay: (empty)
DNS queries minimal:    No
Delivery method:        Maildir in home dir
Split conf files:       No

PHPmailer를 통해 메일을 보냅니다..전송은 되지만 수신이 되지 않나요?

PHP 메일 프로그램

try{
    $mail = new PHPMailer(true);
    $mail->SMTPDebug    = 1;
    $mail->SMTPSecure   = 'tls';
    $mail->SMTPAutoTLS  = false;
    $mail->SMTPAuth     = true;
    $mail->SMTPOptions  = [
        'ssl' => [
            'verify_peer'       => false,
            'verify_peer_name'  => false,
            'allow_self_signed' => true
        ]
    ];
    //$mail->CharSet        = 'UTF-8';
    $mail->IsSMTP();

    $mail->Port     = 25;
    $mail->Host     = '127.0.0.1';
    $mail->Username = 'user';
    $mail->Password = 'pass';

    $mail->AddAddress('[email protected]', 'me');
    $mail->From         = '[email protected]';
    $mail->FromName     = 'me';
    $mail->Subject = 'test mail';
    $mail->Body = 'hello world';
    $mail->Send();
}
catch(phpmailerException $e){
    echo "err: ".$e->getMessage()."\n";
}

phpmailer SMTP 디버그 출력

2019-09-03 06:59:35 CLIENT -> SERVER: EHLO Test-Athlon-3700-2gb
2019-09-03 06:59:35 CLIENT -> SERVER: STARTTLS
2019-09-03 06:59:35 CLIENT -> SERVER: EHLO Test-Athlon-3700-2gb
2019-09-03 06:59:35 CLIENT -> SERVER: AUTH PLAIN
2019-09-03 06:59:35 CLIENT -> SERVER: AGR5bmFjY291bnQAVWF4ZDIwMDEr
2019-09-03 06:59:35 CLIENT -> SERVER: MAIL FROM:<[email protected]>
2019-09-03 06:59:35 CLIENT -> SERVER: RCPT TO:<[email protected]>
2019-09-03 06:59:35 CLIENT -> SERVER: DATA
2019-09-03 06:59:35 CLIENT -> SERVER: Date: Tue, 3 Sep 2019 06:59:35 +0000
2019-09-03 06:59:35 CLIENT -> SERVER: To: me <[email protected]>
2019-09-03 06:59:35 CLIENT -> SERVER: From: me <[email protected]>
2019-09-03 06:59:35 CLIENT -> SERVER: Subject: test mail
2019-09-03 06:59:35 CLIENT -> SERVER: Message-ID: <6ade75e609c3a3e595f324172e0d08eb@Test-Athlon-3700-2gb>
2019-09-03 06:59:35 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.14 (https://github.com/PHPMailer/PHPMailer)
2019-09-03 06:59:35 CLIENT -> SERVER: MIME-Version: 1.0
2019-09-03 06:59:35 CLIENT -> SERVER: Content-Type: text/plain; charset=iso-8859-1
2019-09-03 06:59:35 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2019-09-03 06:59:35 CLIENT -> SERVER:
2019-09-03 06:59:35 CLIENT -> SERVER: hello world
2019-09-03 06:59:35 CLIENT -> SERVER:
2019-09-03 06:59:35 CLIENT -> SERVER: .
2019-09-03 06:59:36 CLIENT -> SERVER: QUIT

답변1

Exim에서는 인증이 활성화되어 있지 않지만(비활성화되어 있음) phpmailer에서는 인증이 필요합니다.

phpmailer에서 TLS 및 인증 요구 사항을 제거합니다.

관련 정보