Skip to content

Instantly share code, notes, and snippets.

@ScottSturdivant
Created February 4, 2016 22:59
Show Gist options
  • Save ScottSturdivant/a0a9cdb2c7ca3ee6a30d to your computer and use it in GitHub Desktop.
Save ScottSturdivant/a0a9cdb2c7ca3ee6a30d to your computer and use it in GitHub Desktop.
from marrow.mailer import Mailer, Message
mailer = Mailer({'transport.use': 'smtp', 'transport.host': 'localhost', 'manager.use': 'immediate'})
msg = Message(author='scott.sturdivant@gmail.com', to='scott.sturdivant@gmail.com')
msg.subject = 'Test Image'
msg.rich = '<b>An image.</b>'
msg.plain = 'An image.'
msg.attach(name='test_img.jpg', data=open('/tmp/test_img.jpg', 'rb').read()
mailer.send(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment