Skip to content

Instantly share code, notes, and snippets.

@chrisdev
Created May 21, 2015 14:43
Show Gist options
  • Save chrisdev/46bf51de3919ab56b8a0 to your computer and use it in GitHub Desktop.
Save chrisdev/46bf51de3919ab56b8a0 to your computer and use it in GitHub Desktop.
sent email with on mandrill with python
# install
# -------
pip install mandrill
# sending the email
# ----------
import mandrill
API_KEY = 'valid_api_key'
def send_mail(template_name, email_to):
mandrill_client = mandrill.Mandrill(API_KEY)
message = {
'to': []
}
for em in email_to:
message['to'].append({'email': em})
mandrill_client.messages.send_template(template_name, [], message)
if __name__ == '__main__':
email_list = ['test@test.com', 'test1@test.com',]
for email in email_list:
send_mail(template_name='newsletter-confirm-subscription', [email])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment