Hello!
Today, I’ll tell you how to set up bulk mailing through Amazon SES from scratch.
First you need to have an account in Amazon Web Services and a service payment method attached to it. If you have it, we can safely begin!
')
SES Setup
So, let's go to the console:
https://console.aws.amazon.com . In the list of services we are looking for SES. Because we have not dealt with SES before, we are met by a depressing inscription:

After all registrations and confirmations that you are not a spammer, you will receive the minimum limits for sending:
- 10,000 emails per day
- 5 letters per second

Next, we need to specify and confirm the address, which will be indicated in the letters in the From field.
In the Verified Senders menu, look for the
Verify a new sender button

So, it remains quite a bit. We have to create an IAM user, give him the right to send mail and assign him a pair of keys. Go here:
https://console.aws.amazon.com/iam .
Create a new group:

Call her:

In the security policy templates, we find a ready-made
Amazon SES Full Access template:

After that, Next, Next, Next, and created a user group.
The next step is to create a user in the Users menu:

Create a user and immediately generate a pair of keys for it:

User created:

Save a pair of his keys:
- Access Key Id: AKIAJXEPJQETZTN7HRNQ
- Secret Access Key: / T + wQ8xSOsm8BtkWcp6kdSSaDHRJT2imn / OoE660
Add a user to the group that was created before, thereby giving the user rights:

So, we have a pair of keys that are given the right to send letters to SES.
SPF record for domain
To validate Amazon SES as a mail sender, add an SPF record to your domain:
v = spf1 include: amazonses.com? allPhp mailer
Next, copy your files from the repository
github.com/korjik/PHP-SES-mailerses.php - class for connecting with SES -
www.orderingdisorder.com/aws/sesusers.csv - sample list of users in the format
"Username", "username@email.com"send_email.php - mail distribution program itself.
In send_email.php, you need to replace the following parameters:
A couple of keys:
$ ses = new SimpleEmailService ('
Access Key Id ', '
Secret Access Key ');
Validated From:
$ m-> setFrom ('
validated@email.com ');
Next, fill in 2 text fields - the variables $ text_email and $ html_email are responsible for themselves with names.
If preparations are made, the script can be run with the path parameter to the users.csv file:
$ php send_email.php users.csv
Total
All users listed in users.csv will receive emails.
Tips
Do not use a validated From address from foreign domains. The absence of SPF records increases the chance of emails getting into spam.
Tuning
As you have noticed, we can insert the user name, read as
$ username = $ user_fields [0] from the CSV file into each letter. Thereby, you yourself can change the CSV format, add custom fields, etc.
If you have questions, write, I will answer.
Shl. The article was written specifically for Mr.
m31 .