Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- from email.mime.multipart import MIMEMultipart
- from email.mime.text import MIMEText
- # me == my email address
- # you == recipient's email address
- me = "devjirak@gmail.com"
- you = "sahat_maruli@ymail.com"
- # Create message container - the correct MIME type is multipart/alternative.
- msg = MIMEMultipart('alternative')
- msg['Subject'] = "Link"
- msg['From'] = me
- msg['To'] = you
- # Create the body of the message (a plain-text and an HTML version).
- text = "Hi!\n ini invite dari meta?\nhttp://www.python.org"
- html = """\
- <html>
- <head></head>
- <body>
- <p>Hi!<br>
- 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>
- <img src="http://qr-official.line.me/L/c4abfI7I3w.png">
- </p>
- </body>
- </html>
- """
- # Record the MIME types of both parts - text/plain and text/html.
- part1 = MIMEText(text, 'plain')
- part2 = MIMEText(html, 'html')
- # Attach parts into message container.
- # According to RFC 2046, the last part of a multipart message, in this case
- # the HTML message, is best and preferred.
- msg.attach(part1)
- msg.attach(part2)
- server = smtplib.SMTP('smtp.gmail.com', 587)
- server.starttls()
- # smtp.connect('devjirak@gmail.com')
- server.login('devjirak@gmail.com', 'python777')
- server.sendmail(me, you, msg.as_string())
- server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement