简体   繁体   中英

Email issues with Wordpress running on AWS Elastic Beanstalk

I'm running Wordpress 4.2 on AWS Elastic Beanstalk. I'm using a plugin that sends emails using the WP email API, which uses the server's (ie Elastic Beanstalk's) internal mail system.

The problem: emails that the app attempts to send to my university email (let's call it .uni.edu) fail, and they do work when sent to my standard gmail.

What's interesting is that I have no issues running the same application locally. The emails associated with the app send fine -- so obviously there's some issue with the way Elastic Beanstalk in particular is attempting to relay the messages to the .uni.edu server. Perhaps the .uni.edu server is picking it up as spam (when sent from Elastic Beanstalk, not when being sent through my local system) and bouncing it back, but I'm not experienced enough to diagnose this.

Does anyone have suggestions for either directly applying some kind of fix to this problem, or creating some sort of setup that is a workaround (eg setting something up on Elastic Beanstalk to send emails in a non-default way that is less likely to have issues working with the university email server)?

Here's a log from /var/mail:

From MAILER-DAEMON@ip-172-31-41-109.ec2.internal  Fri Apr 24 21:39:52 2015
Return-Path: <MAILER-DAEMON@ip-172-31-41-109.ec2.internal>
Received: from localhost (localhost)
    by ip-172-31-41-109.ec2.internal (8.14.4/8.14.4) id t3OLdq1k026047;
    Fri, 24 Apr 2015 21:39:52 GMT
Date: Fri, 24 Apr 2015 21:39:52 GMT
From: Mail Delivery Subsystem <MAILER-DAEMON@ip-172-31-41-109.ec2.internal>
Message-Id: <201504242139.t3OLdq1k026047@ip-172-31-41-109.ec2.internal>
To: <webapp@ip-172-31-41-109.ec2.internal>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
    boundary="t3OLdq1k026047.1429911592/ip-172-31-41-109.ec2.internal"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message

--t3OLdq1k026047.1429911592/ip-172-31-41-109.ec2.internal

The original message was received at Fri, 24 Apr 2015 21:39:42 GMT
from localhost [127.0.0.1]

   ----- The following addresses had permanent fatal errors -----
<univstudent@uni.edu>
    (reason: 553 5.1.8 <webapp@ip-172-31-41-109.ec2.internal>... Domain of sender address webapp@ip-172-31-41-109.ec2.internal does not exist)

   ----- Transcript of session follows -----
... while talking to apathy.uni.edu.:
>>> MAIL From:<webapp@ip-172-31-41-109.ec2.internal> SIZE=1191
<<< 553 5.1.8 <webapp@ip-172-31-41-109.ec2.internal>... Domain of sender address webapp@ip-172-31-41-109.ec2.internal does not exist
501 5.6.0 Data format error

--t3OLdq1k026047.1429911592/ip-172-31-41-109.ec2.internal
Content-Type: message/delivery-status

Reporting-MTA: dns; ip-172-31-41-109.ec2.internal
Received-From-MTA: DNS; localhost
Arrival-Date: Fri, 24 Apr 2015 21:39:42 GMT

Final-Recipient: RFC822; univstudent@uni.edu
Action: failed
Status: 5.1.8
Diagnostic-Code: SMTP; 553 5.1.8 <webapp@ip-172-31-41-109.ec2.internal>... Domain of sender address webapp@ip-172-31-41-109.ec2.internal does not exist
Last-Attempt-Date: Fri, 24 Apr 2015 21:39:52 GMT

--t3OLdq1k026047.1429911592/ip-172-31-41-109.ec2.internal
Content-Type: message/rfc822

Return-Path: <webapp@ip-172-31-41-109.ec2.internal>
Received: from ip-172-31-41-109.ec2.internal (localhost [127.0.0.1])
    by ip-172-31-41-109.ec2.internal (8.14.4/8.14.4) with ESMTP id t3OLdg1k026045
    for <univstudent@uni.edu>; Fri, 24 Apr 2015 21:39:42 GMT
Received: (from webapp@localhost)
    by ip-172-31-41-109.ec2.internal (8.14.4/8.14.4/Submit) id t3OLdgcq026044;
    Fri, 24 Apr 2015 21:39:42 GMT
To: univstudent@uni.edu
Subject: [classifiedads] Password Reset
X-PHP-Originating-Script: 498:class-phpmailer.php
Date: Fri, 24 Apr 2015 21:39:42 +0000
From: WordPress <wordpress@classifiedads-test.elasticbeanstalk.com>
Message-ID: <bace4f13cdc099117cd4ac9c70e2531c@classifiedads-test.elasticbeanstalk.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Someone requested that the password be reset for the following account:

http://classifiedads-test.elasticbeanstalk.com/

Username: univstudentseas

If this was a mistake, just ignore this email and nothing will happen.

To reset your password, visit the following address:

<http://classifiedads-test.elasticbeanstalk.com/wp-login.php?action=rp&key=dzaUvJpcjAe243gNOysZ&login=univstudentseas>


--t3OLdq1k026047.1429911592/ip-179-35-41-109.ec2.internal--

This sounds very similar to another recent question about email:

http://stackoverflow.com/questions/29808262/unable-to-send-emails-from-linux/29810884#29810884

Does your ec2 instance have an associated external DNS? Is there a public IP associated with it. You'll need to apply some type of fix so that your outgoing email message has a domain other than webapp@ip-172-31-41-109.ec2.internal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM