Package: seacucumber-py3
Info:A Django email backend for Amazon Simple Email Service, backed bydjango-celeryAuthor:DUO Interactive, LLCInspired by:Harry Marr’sdjango-ses.Status:Unmaintained. Let us know if you’d like to step in!A bird’s eye viewSea Cucumber is a mail backend forDjango. Instead of sending emails
through a traditional SMTP mail server, Sea Cucumber routes email through
Amazon Web Services’ excellent Simple Email Service (SES) viadjango-celery.Why Sea Cucumber/SES instead of SMTP?Configuring, maintaining, and dealing with some complicated edge cases can be
time-consuming. Sending emails with Sea Cucumber might be attractive to you if:You don’t want to maintain mail servers.Your mail server is slow or unreliable, blocking your views from rendering.You need to send a high volume of email.You don’t want to have to worry about PTR records, Reverse DNS, email
whitelist/blacklist services.You are already deployed on EC2 (In-bound traffic to SES is free from EC2
instances). This is not a big deal either way, but is an additional perk if
you happen to be on AWS.InstallationAssuming you’ve gotDjangoanddjango-celeryinstalled, you’ll needBoto2.0b4 or higher.botois a Python library that wraps the AWS API.You can do the following to installboto2.0b4 (we’re using –upgrade here to
make sure you get 2.0b4):pip install --upgrade botoInstall Sea Cucumber:pip install seacucumberAdd the following to your settings.py:EMAIL_BACKEND = 'seacucumber.backend.SESBackend'

# These are optional -- if they're set as environment variables they won't
# need to be set here as well
AWS_ACCESS_KEY_ID = 'YOUR-ACCESS-KEY-ID'
AWS_SECRET_ACCESS_KEY = 'YOUR-SECRET-ACCESS-KEY'

# Make sure to do this if you want the ``ses_address`` management command.
INSTALLED_APPS = (
    ...
    'seacucumber'
)Email Address VerificationBefore you can send email ‘from’ an email address through SES, you must first
verify your ownership of it:./manage.py ses_address verify batman@gotham.govAfter you’ve run the verification above you will need to check the email
account’s inbox (from your mail client or provider’s web interface) and click
the authorization link in the email Amazon sends you. After that, your address
is ready to go.To confirm the verified email is ready to go:./manage.py ses_address listTo remove a previously verified address:./manage.py ses_address delete batman@gotham.govNow, when you usedjango.core.mail.send_mailfrom a verified email address,
Sea Cucumber will handle message delivery.Rate LimitingIf you are a new SES user, your default quota will be 1,000 emails per 24
hour period at a maximum rate of one email per second. Sea Cucumber defaults
to enforcing the one email per second at the celery level, but you must not
have disabled celery rate limiting.If you have this:CELERY_DISABLE_RATE_LIMITS = TrueChange it to this:CELERY_DISABLE_RATE_LIMITS = FalseThen check your SES max rate by running:./manage.py ses_usageIf your rate limit is more than1.0/sec, you’ll need to set that numeric
value in yourCUCUMBER_RATE_LIMITsetting like so:# Rate limit to three outgoing SES emails a second.
CUCUMBER_RATE_LIMIT = 3Failure to follow the rate limits may result in BotoServerError exceptions
being raised, which makes celery unhappy.As a general note, your quota and max send rate will increase with usage, so
check theses_usagemanagement command again at a later date after you’ve
sent some emails. You’ll need to manually bump up your rate settings insettings.py.Routing TasksIf you want to route Sea Cucumber task to different queues.Add this to setting:CUCUMBER_ROUTE_QUEUE = 'YOUR-ROUTE-QUEUE'Then update the celery configuration for routes. Example celeryconfig.py:CELERY_ROUTES = {
    'seacucumber.tasks.#': {'queue': 'YOUR-ROUTE-QUEUE'},
}DKIMUsingDomainKeysis entirely optional, however it is recommended by Amazon for
authenticating your email address and improving delivery success rate.  Seehttp://docs.amazonwebservices.com/ses/latest/DeveloperGuide/DKIM.html.
Besides authentication, you might also want to consider using DKIM in order to
remove thevia email-bounces.amazonses.commessage shown to gmail users -
seehttp://support.google.com/mail/bin/answer.py?hl=en&answer=1311182.To enable DKIM signing you should install thepydkimpackage and specify values
for theDKIM_PRIVATE_KEYandDKIM_DOMAINsettings.  You can generate a
private key with a command such asopenssl genrsa 1024and get the public key
portion withopenssl rsa-pubout<private.key.  The public key should be
published toses._domainkey.example.comif your domain is example.com.  You
can use a different name instead ofsesby changing theDKIM_SELECTORsetting.The SES relay will modify email headers such asDateandMessage-Idso by
default only theFrom,To,Cc,Subjectheaders are signed, not the full
set of headers.  This is sufficient for most DKIM validators but can be overridden
with theDKIM_HEADERSsetting.Example settings.py:DKIM_DOMAIN = 'example.com'
DKIM_PRIVATE_KEY = '''
-----BEGIN RSA PRIVATE KEY-----
xxxxxxxxxxx
-----END RSA PRIVATE KEY-----
'''Example DNS record published to Route53 with boto:route53 add_record ZONEID ses._domainkey.example.com. TXT ‘“v=DKIM1; p=xxx”’ 86400Django Builtin-in Error EmailsIf you’d like Django’sBuiltin Email Error Reportingto function properly
(actually send working emails), you’ll have to explicitly set theSERVER_EMAILsetting to one of your SES-verified addresses. Otherwise, your
error emails will all fail and you’ll be blissfully unaware of a problem.Note:You can use the includedses_addressmanagement command to handle
address verification.Getting HelpIf you have any questions, feel free to either post them to ourissue tracker.