I was able to get Amazon's Simple Email Service working relatively easily 
using the "Boto" library. I tried to write up a slice but couldn't figure 
out how to format it 
properly: http://web2pyslices.com/main/slices/take_slice/123

1. Sign up for Amazon Web Services: http://aws.amazon.com

2. Enable "Simple Email Service": http://aws.amazon.com/ses/

3. Install Boto in your Web2py "site-packages" folder: 
https://github.com/boto/boto

4. Obtain your Amazon AWS-KEY and AWS-SECRET-KEY: 
https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key

5. Before you get "production" access to Amazon's mail servers, you have to 
pre-register every sender and recipient email address you want to use (up to 
100). This is OK for development and testing but of course would not work in 
production. To register an email address, execute the following code, 
replacing AWS-KEY and AWS-SECRET-KEY with your own keys and 
[email protected] with the email address you want to register:

    from boto.ses.connection import SESConnection
    def verify_email_address():
        conn = SESConnection('<AWS-KEY>', '<AWS-SECRET-KEY>')
        m = conn.verify_email_address('[email protected]')

6. Now you are ready to send an email:

    from boto.ses.connection import SESConnection
    
    aws_key = '<AWS-KEY>'
    aws_secret_key = '<AWS-SECRET-KEY>'
    
    def send_ses(params):
        conn = SESConnection(aws_key, aws_secret_key)
        return conn.send_email(source='[email protected]',
                            subject='Subject',
                            body='Body.',
                            to_addresses='[email protected]',
                            cc_addresses=None,
                            bcc_addresses=None,
                            format='text',
                            reply_addresses=None,
                            return_path=None)

Reply via email to