Horje
python SMTP sendmail Code Example
email authentication python
import smtplib

server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.login("your username", "your password")
server.sendmail(
  "from@address.com", 
  "to@address.com", 
  "this message is from python")
server.quit()
python SMTP sendmail
#!/usr/bin/env python

import smtplib
from email.mime.text import MIMEText

sender = 'admin@example.com'
receivers = ['info@example.com']


port = 1025
msg = MIMEText('This is test mail')

msg['Subject'] = 'Test mail'
msg['From'] = 'admin@example.com'
msg['To'] = 'info@example.com'

with smtplib.SMTP('localhost', port) as server:
    
    # server.login('username', 'password')
    server.sendmail(sender, receivers, msg.as_string())
    print("Successfully sent email")
Source: zetcode.com




Python

Related
<ipython-input-7-474520f490a8> Code Example <ipython-input-7-474520f490a8> Code Example
top automotive blogs Code Example top automotive blogs Code Example
Allow Complex Number like "1+2j" to be treated as valid number Code Example Allow Complex Number like "1+2j" to be treated as valid number Code Example
cx_freeze include images in specific path Code Example cx_freeze include images in specific path Code Example
read stripped lines from a file python Code Example read stripped lines from a file python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7