Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.40 KB | None | 0 0
  1. import smtplib
  2.  
  3. from email.mime.multipart import MIMEMultipart
  4. from email.mime.text import MIMEText
  5.  
  6. # me == my email address
  7. # you == recipient's email address
  8. me = "devjirak@gmail.com"
  9. you = "sahat_maruli@ymail.com"
  10.  
  11. # Create message container - the correct MIME type is multipart/alternative.
  12. msg = MIMEMultipart('alternative')
  13. msg['Subject'] = "Link"
  14. msg['From'] = me
  15. msg['To'] = you
  16.  
  17. # Create the body of the message (a plain-text and an HTML version).
  18. text = "Hi!\n ini invite dari meta?\nhttp://www.python.org"
  19. html = """\
  20. <html>
  21.  <head></head>
  22.  <body>
  23.    <p>Hi!<br>
  24.       Here is the  <a href="https://line.me/R/ti/p/%40vnd2348s"><img height="36" border="0" alt="Tambah Teman" src="https://scdn.line-apps.com/n/line_add_friends/btn/en.png"></a>
  25.       <img src="http://qr-official.line.me/L/c4abfI7I3w.png">
  26.    </p>
  27.    
  28.  </body>
  29. </html>
  30. """
  31.  
  32. # Record the MIME types of both parts - text/plain and text/html.
  33. part1 = MIMEText(text, 'plain')
  34. part2 = MIMEText(html, 'html')
  35.  
  36. # Attach parts into message container.
  37. # According to RFC 2046, the last part of a multipart message, in this case
  38. # the HTML message, is best and preferred.
  39. msg.attach(part1)
  40. msg.attach(part2)
  41.  
  42. server = smtplib.SMTP('smtp.gmail.com', 587)
  43. server.starttls()
  44. # smtp.connect('devjirak@gmail.com')
  45. server.login('devjirak@gmail.com', 'python777')
  46. server.sendmail(me, you, msg.as_string())
  47. server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement