forked from pankratiev/python-amazon-ses-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
53 lines (38 loc) · 1.82 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Python API for Amazon Simple Email Service
http://aws.amazon.com/ses/
===============
Description
===============
Here is an example of how to send an email using the API:
(Note that you should specify correct values of your AccessKeyID, SecretAccessKey and source/destionation email addresses)
from amazon_ses import AmazonSES, EmailMessage
AccessKeyID = '--YourAccessKeyID--'
SecretAccessKey = '--YourSecretAccessKey--'
amazonSes = AmazonSES(AccessKeyID, SecretAccessKey)
message = EmailMessage()
message.subject = 'Hello from Amazon SES! Test subject'
message.bodyText = 'This is body text of test message.'
result = amazonSes.sendEmail('[email protected]', '[email protected]', message)
print result.requestId
print result.messageId
I want you to notice that in case Amazon returns some error, the API will raise an exception AmazonError which will contain errorType, code and message.
If your Amazon SES account is not switched to production use, you can send a message only from/to verified email addresses. Here is an example of how to verify the email using the API:
result = amazonSes.verifyEmailAddress('[email protected]')
print result.requestId
You will receive the confirmation with a link which you should click to verify your email.
An example of how to receive information about SendQuota:
result = amazonSes.getSendQuota()
print result.requestId
print result.max24HourSend, result.maxSendRate, result.sentLast24Hours
===============
Currently the API supports the following Amazon SES actions:
SendEmail
VerifyEmailAddress
DeleteVerifiedEmailAddress
GetSendQuota
ListVerifiedEmailAddresses
Methods return instances of AmazonResult or derived class (for example, method amazonSes.getSendQuota() returns the instance of AmazonSendQuota).
Author
===============
Vladimir Pankratiev
http://tagmask.com