Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import smtplib
  2. import MimeWriter
  3. import mimetools
  4. import StringIO
  5.  
  6. from email.MIMEText import MIMEText
  7. def sendTextMail(to, Subject ,text):
  8. from = "Expediteur <toto@gmail.com>"
  9. mail = MIMEText(text)
  10. mail['From'] = from
  11. mail['Subject'] = Subject
  12. mail['To'] = to
  13. smtp = smtplib.SMTP()
  14. smtp.connect()
  15. smtp.sendmail(from, [to], mail.as_string())
  16. smtp.close()
  17.  
  18. sendTextMail("titi@gmail.com", "coucou", "comment tu vas robin?")
  19.  
  20. File "./sendmail.py", line 10
  21. from = "Expediteur <toto@gmail.com>"
  22. ^
  23. SyntaxError: invalid syntax
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement