PostFIXメールサーバーを実行してみてください。しかし、Eメール送信は機能しません

PostFIXメールサーバーを実行してみてください。しかし、Eメール送信は機能しません

PHPでmail()関数を使用するためにpostfix MTAを設定しようとしています。 Mac OSX sierra PHP バージョン 7.1.0 で MAMP 4.1 無料版を使用する 私は基本に固執したいので、MAMP PRO や SwiftMailer などのサードパーティ製ライブラリの使用に興味はありません。

これまで、以下を完了するために更新しました。

  1. 私の資格情報を使用してsasl_passwdというファイルを作成しました。

    [smtp.gmail.com]:587 [email protected]:mypassword
    
  2. 次に、次のコマンドを使用します。

    sudo postmap /etc/postfix/sasl_passwd
    sudo chgrp postfix sasl_passwd*
    sudo chmod 0640 sasl_passwd*
    sudo postmap -q [smtp.gmail.com]:587 sasl_passwd
    
  3. /etc/postfix/でmain.cfを開き、最後に次の行を追加します。

    #Gmail SMTP
    relayhost=smtp.gmail.com:587
    # Enable SASL authentication in the Postfix SMTP client.
    smtp_sasl_auth_enable=yes
    smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options=noanonymous
    smtp_sasl_mechanism_filter=plain
    # Enable Transport Layer Security (TLS), i.e. SSL.
    smtp_use_tls=yes
    smtp_tls_security_level=encrypt
    tls_random_source=dev:/dev/urandom 
    
  4. Postfix サービスを再起動して更新します。

  5. 端末からメールを送信し、端末自体でメールを確認してみると、次のような回答を受けました。

    From MAILER-DAEMON  Thu Feb  9 14:53:14 2017
    X-Original-To: [email protected]
    Delivered-To: [email protected]
    Date: Thu,  9 Feb 2017 14:53:14 +0530 (IST)
    From: [email protected] (Mail Delivery System)
    Subject: Undelivered Mail Returned to Sender
    To: [email protected]
    Auto-Submitted: auto-replied
    MIME-Version: 1.0
    Content-Type: multipart/report; report-type=delivery-status;
            boundary="CD41810841CF.1486632194/MacBook-Pro.local"
    
    This is a MIME-encapsulated message.
    
    --CD41810841CF.1486632194/MacBook-Pro.local
    Content-Description: Notification
    Content-Type: text/plain; charset=us-ascii
    
    This is the mail system at host MacBook-Pro.local.
    
    I'm sorry to have to inform you that your message could not
    be delivered to one or more recipients. It's attached below.
    
    For further assistance, please send mail to postmaster.
    
    If you do so, please include this problem report. You can
    delete your own text from the attached returned message.
    
                       The mail system
    
    <[email protected]>: host smtp.gmail.com[74.125.200.109] said:
        530-5.5.1 Authentication Required. Learn more at 530 5.5.1
        https://support.google.com/mail/?p=WantAuthError a25sm27067419pgd.26 -
        gsmtp (in reply to MAIL FROM command)
    
    --CD41810841CF.1486632194/MacBook-Pro.local
    Content-Description: Delivery report
    Content-Type: message/delivery-status
    
    Reporting-MTA: dns; MacBook-Pro.local
    X-Postfix-Queue-ID: CD41810841CF
    X-Postfix-Sender: rfc822; [email protected]
    Arrival-Date: Thu,  9 Feb 2017 14:53:11 +0530 (IST)
    
    Final-Recipient: rfc822; [email protected]
    Original-Recipient: rfc822;[email protected]
    Action: failed
    Status: 5.5.1
    Remote-MTA: dns; smtp.gmail.com
    Diagnostic-Code: smtp; 530-5.5.1 Authentication Required. Learn more at 530
        5.5.1  https://support.google.com/mail/?p=WantAuthError a25sm27067419pgd.26
        - gsmtp
    
    --CD41810841CF.1486632194/MacBook-Pro.local
    Content-Description: Undelivered Message
    Content-Type: message/rfc822
    
    Return-Path: <[email protected]>
    Received: by MacBook-Pro.local (Postfix, from userid 501)
            id CD41810841CF; Thu,  9 Feb 2017 14:53:11 +0530 (IST)
    To: [email protected]
    Subject: testing
    Message-Id: <[email protected]>
    Date: Thu,  9 Feb 2017 14:53:11 +0530 (IST)
    From: [email protected] (Admin)
    
    Thu Feb  9 14:53:11 IST 2017
    
    --CD41810841CF.1486632194/MacBook-Pro.local--
    
    acBook-Pro.local--
    
  6. この問題を解決するために、Gmailはセキュリティレベルの低いアプリへのアクセスを許可してみました。開いてみてください。まだ成功していません。

  7. /var/log/mailを表示しようとしていますが、メールログを表示できません。同じディレクトリにmail.logファイルを作成しましたが、登録されたログはありません。端末を使用してrsyslogを再起動しました。それでも動作しません。

私のPHPスクリプトでmail()関数を使用し、それに応じてPHP.iniを変更したいと思います。可能であれば、これに関する指示を提案してください。

ベストアンサー1

おすすめ記事