|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
These instructions were tested on a 64-bit Amazon EC2 instance using the following Amazon Machine Image (AMI):
Amazon Linux AMI 2012.09 (ami-1624987f), which runs Linux 3.2
For more information about AMIs, see Amazon Machine Images (AMIs).
Before you perform the following procedures, verify the following:
Sendmail is installed on your computer, and you are able to successfully send an email using Sendmail without Amazon SES.
If you are sending email from an Amazon EC2 instance with or without Amazon SES, you may need to assign an Elastic IP Address to your Amazon EC2 instance for the receiving ISP to accept your email. For more information, see Amazon EC2 Elastic IP Addresses.
In addition to the Sendmail package, the following packages are installed on your computer: Sendmail-cf and m4.
The Amazon SES Perl scripts are installed and set up on your computer, and as a test, you are able to successfully send an email using the ses-send-email.pl script. For more information, see Appendix: Amazon SES Scripts and Sending Formatted Email.
You have verified your "From" address and, if you do not yet have production access, you have also verified your "To" addresses. For more information, see Verifying Email Addresses in Amazon SES.
(Optional) If you are sending email through Amazon SES from an Amazon EC2 instance, you can fill out a Request to Remove Email Sending Limitations to remove the additional sending limit restrictions that are applied to port 25 by default.
To integrate ses-send-email.pl with Sendmail
On your mail server, save a back-up copy of /etc/mail/sendmail.mc and /etc/mail/sendmail.cf.
Open the /etc/mail/sendmail.mc file.
To configure a new mailer, add the following lines to sendmail.mc before any MAILER() lines. If you add
the lines after a MAILER() line, when you run
m4 in a subsequent step you will get the following error:
"ERROR: FEATURE() should be before MAILER().".
Modify the text to reflect your particular situation.
MAILER_DEFINITIONS Maws-email, P=/opt/third-party/amazon/ses-send-email.pl, F=mDFMuXn, U=mailuser, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, A=ses-send-email.pl -r -k /opt/third-party/amazon/aws-credentials -e https://email.us-east-1.amazonaws.com -f $f $u MASQUERADE_AS(YOUR_DOMAIN)dnl FEATURE(masquerade_envelope)dnl FEATURE(masquerade_entire_domain)dnl
Note the following about this example:
The U parameter must specify a non-root user (i.e., a nonadministrative user). The user "mailuser" is for illustrative purposes only.
The ses-send-email.pl script and the credentials file reside in the /opt/third-party/amazon directory.
The endpoint for communicating with Amazon SES is https://email.us-east-1.amazonaws.com.
In the line that starts with
YOUR_DOMAIN must be replaced with the domain name from which you are sending your email. By adding this masquerade,
you are making email from this host appear to be sent from your domain. Otherwise, the email will appear as
if the email is being sent from the host name of the mail server, and you will get an "Email address not verified" error when
you try to send an email.
You should modify these parameters as appropriate.
Verify that the mailertable feature is enabled. Look for the following line:
If this line does not exist, you will need to add it.
Open or create the /etc/mail/mailertable file.
Add the following line to /etc/mail/mailertable to send all email using the aws-email mailer:
<TAB> with an actual TAB character.
Build the mailertable database.
sudo makemap hash /etc/mail/mailertable.db < /etc/mail/mailertable
At a command prompt, type the following command to make sendmail.cf writeable:
sudo chmod 666 /etc/mail/sendmail.cf
At a command prompt, type the following command to recreate sendmail.cf:
sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
At a command prompt, type the following command to reset the permissions of sendmail.cf to read only:
sudo chmod 664 /etc/mail/sendmail.cf
At a command prompt, type the following command to restart Sendmail:
sudo /etc/init.d/sendmail restart
If you encounter errors when restarting Sendmail, you can restart Sendmail in debug mode:
sudo /etc/init.d/sendmail restart -bD -O LogLevel=20 -X /tmp/sendmail.log
To verify your configuration, generate a deliverability report:
sudo sendmail -bv firstname.lastname@example.org
In this report, look for the following output:
email@example.com... deliverable: mailer awsemail, host example.com, user firstname.lastname@example.org
At a command prompt, type the following to send a test email:
sudo /usr/bin/sendmail -f email@example.com firstname.lastname@example.org This email is sent through Amazon SES. ^D
Replace email@example.com with your "From" email address, which you must have verified with Amazon SES. Replace firstname.lastname@example.org with your "To" address. If you have not yet applied for production access, the "To" address must be verified also. Then, press <Enter>. Type the body of the message, pressing <Enter> after each line. When you are finished typing the email, press CTRL-D to send the email.
Check the recipient email's client for the email. If you cannot find the email, check the Junk box in the recipient's email client. If you still cannot find the email, look at the Sendmail log on the mail server. The log is typically in /var/spool/mail/<user>.
If your mail does not arrive, look in the mail log for the following error:
Can't locate SES.pm in @INC
This message indicates that the SES.pm Perl module does not exist or cannot be found on your system. For more information, refer to the README file that comes with the Amazon SES scripts.