Here is a very simple example:
import smtplib
server = 'mail.server.com'
user = ''
password = ''
recipients = ['[email protected]', '[email protected]']
sender = '[email protected]'
message = 'Hello World'
session = smtplib.SMTP(server)
# if your SMTP server doesn't need authentications,
# you don't need the following line:
session.login(user, password)
session.sendmail(sender, recipients, message)
For more options, error handling, etc, look at the smtplib module documentation.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…