Coder Social home page Coder Social logo

bkeroack / python-amazon-ses-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pankratiev/python-amazon-ses-api

0.0 2.0 0.0 120 KB

Python API for Amazon Simple Email Service

Home Page: http://tagmask.com/vladimir/posts/26

Python 100.00%

python-amazon-ses-api's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.