Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. import smtplib
  2.  
  3. from email.mime.multipart import MIMEMultipart
  4. from email.mime.text import MIMEText
  5.  
  6. username = 'it';
  7. password = 'FlexibleTable123'
  8.  
  9. mailserver = '172.16.10.25:587'
  10.  
  11. mailfrom = 'it@transfashionindonesia.com'
  12. mailto   = 'agung@transfashionindonesia.com'
  13. mailsubject = 'Kirim email dengan python'
  14. mailbody = 'test mengirimkan email menggunakan python mudah sekali'
  15.  
  16. # buat pesannya
  17. msg = MIMEMultipart('alternative')
  18. msg['Subject'] = mailsubject
  19. msg['From'] = mailfrom
  20. msg['To'] = mailto
  21. msg.attach(MIMEText(mailbody, 'plain'))
  22.  
  23. server = smtplib.SMTP('172.16.10.25:587')
  24. server.starttls()
  25. server.login(username, password)
  26. server.sendmail(mailfrom, mailto, msg.as_string())
  27. server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement