daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3.  
  4. import sys
  5. from getpass import getpass
  6. from email_utils import EmailConnection, Email
  7.  
  8.  
  9. print 'I need some information...'
  10. name = raw_input(' - Your name: ')
  11. email = raw_input(' - Your e-mail: ')
  12. password = getpass(' - Your password: ')
  13. mail_server = raw_input(' - Your mail server: ')
  14. to_email = raw_input(' - Destination email: ')
  15. to_name = raw_input(' - Name of destination: ')
  16. subject = 'Sending mail easily with Python'
  17. message = 'here is the message body'
  18. attachments = [sys.argv[0]]
  19.  
  20. print 'Connecting to server...'
  21. server = EmailConnection(mail_server, email, password)
  22. print 'Preparing the email...'
  23. email = Email(from_='"%s" <%s>' % (name, email),  # you can pass only email
  24.               to='"%s" <%s>' % (to_name, to_email),  # you can pass only email
  25.               subject=subject, message=message, attachments=attachments)
  26. print 'Sending...'
  27. server.send(email)
  28. print 'Disconnecting...'
  29. server.close()
  30. print 'Done!'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top