use SES to send messages
(1) When using ses (simple email Service) to send an email, we need to add a sender's mailbox (verify email sender), SES use this sender's mailbox as the sender, after adding the authenticated sender, Need to login sender email Click confirm connection.
SNS (simple messaging service) also has a similar function, called topic, similar to mail group, add multiple verified receivers to a topic, and then in Cloudwatch or other service calls, to send group mail. This time the SNS is not discussed first.
You can use this small snippet of code to add verified sender
Import boto.ses
conn = boto.ses.connect_to_region (' us-east-1 ')
Conn.verify_email_address (' sender@address.com ')
By the time I write these, SES only supports three regions, Virginia,ireland,oregon (corresponding to Us-east-1, Eu-west-1, us-west-2)
(2) Next we collect SMTP credential related information
In SMTP settings we can see SMTP-related information, such as the Virginia area:
Server name:email-smtp.us-east-1.amazonaws.com
PORT:25, 465 or 587
Use transport Layer Security (TLS): Yes
Authentication:your SMTP Credentials-see below.
Then create an SMTP credential Click to create, and he automatically creates an IAM role and authorizes it, and produces a set of information similar to accesskey, but the name becomes username and password, like this:
IAM User name,smtp username,smtp Password
"Ses-smtp-user.xxxx", akixxx,aqbxxxxxxxxxxxxxxxxxx
(3) This information is collected by using SMTP email. You can use Configobj to load credential in a configuration file and Smtplib to create an object to send messages to
Import Smtplib
From configobj import configobj
CFG = configobj (Config_path)
Cfg_dict = Cfg.dict ()
Host = cfg_dict["Server"]
FROM_ADDR = cfg_dict["From_addr"]
Username = cfg_dict["username"]
Password = cfg_dict["Password"]
Server = Smtplib. SMTP (host)
Server.starttls ()
Server.login (username, password)
Server.sendmail (FROM_ADDR, receivers, body)
Server.quit ()
Configuration file Shape:
Server = email-smtp.us-east-1.amazonaws.com
FROM_ADDR = sender@domain.com
Username = akixxx
Password = aqbxxxxxxxxxxxxxxxxxx
Graphical steps for using the Amazon cloud Amazon ses email
Ordinary enterprise Send mail very few, general use Gmail, 163.com, hotmail.com, QQ mailbox and so on the mailbox sends directly to be possible.
But if you have more customers, the daily delivery of more than 500, this becomes a big problem, because the above mentioned mailbox daily delivery quantity is limited, more will not send out.
Amazon Cloud (AWS) is the world's oldest and most mature cloud platform, it provides a mail service called SES, specifically to meet the above, send tens of thousands of daily is no problem.
Register Amazon Cloud account, search Amazon cloud can find.
You need a mobile phone, a regular credit card when registering your account
Install an ordinary mail client software, such as Foxmail, Outlook
Method/Step
The first is to register the Amazon cloud account, and login to the AWS Management Console, select SES to enter.
When you enter, you will see this blue button.
The default registration Amazon Cloud account is not open SES mail service, need to apply separately.
Click on the Blue button to enter the Application page.
The first two items on the application page are the default, and the third region is to select the area, and the number one will be OK.
Pre-production Checklist: All 3 items in this option are selected.
Use case Description: This describes what you do with the SES mail Service, to be written in English.
Upon completion of the application, return to the SES Mail Service interface, the Amazon will be approved within 24 hours, will be able to see the results. Look at this picture of the sending quota this article, if it becomes 10,000, the Amazon audit through, this time can send an e-mail.
Select the SMTP Setting, click Create my SMTP this blue button, and then click the Create button, be sure to remember this username and password.
Install a client software, such as Outlook, Foxmail.
Write down the corresponding SMTP message settings according to the location of the picture, and add it to your client software.
Click the email address, enter the verification of the sending email addresses page, add their own mail, the verification of the time Amazon will send you a verification letter, confirm that you can.
This is the time to use your mail client software to start sending mail, thousands of days of hair is no problem.
But here are some things to note:
1, a letter mail day best not to send more than 5000, or later will be sent into the garbage inbox.
2, it is best not to issue at once, because the post office has a frequency limit, the continuous hair too much, the actual many did not send to.
can also find some professional use of the Amazon SES to send mail tools, these software can be regularly sent, set the sending frequency, set the Send task, automatically generate mail blacklist, query bounce mail, and some can send different content according to different customers and so on.
Mail blacklist: Empty email address and user unsubscribe (user point This is a spam message)
Bounce Mail: Received the server asynchronous return information, it is possible to return after 1-2 hours, actually for various reasons did not send to, such as the frequency of transmission too fast, the content of the message does not meet the requirements.
Of course, a lot of such tools, search can be found, more contrast, you can find their satisfaction.
Good luck with all of you.
Attention matters
Register Amazon Cloud Account can only be a credit card a phone account, can not repeat registration.
To apply for the opening of the SES Mail service, you need to describe the reasons for the application is more clear, not a stroke.