[COLOR=#000088]import[/COLOR] smtplib
message [COLOR=#666600]=[/COLOR] [COLOR=#008800]"""From: From Person <[email protected]>
To: To Person <[email protected]>
MIME-Version: 1.0
Content-type: text/html
Subject: SMTP HTML e-mail test
This is an e-mail message to be sent in HTML format
<b>This is HTML message.</b>
<h1>This is headline.</h1>
"""[/COLOR]
[COLOR=#000088]try[/COLOR][COLOR=#666600]:[/COLOR]
smtpObj [COLOR=#666600]=[/COLOR] smtplib[COLOR=#666600].[/COLOR]SMTP[COLOR=#666600]([/COLOR][COLOR=#008800]'localhost'[/COLOR][COLOR=#666600])[/COLOR]
smtpObj[COLOR=#666600].[/COLOR]sendmail[COLOR=#666600]([/COLOR]sender[COLOR=#666600],[/COLOR] receivers[COLOR=#666600],[/COLOR] message[COLOR=#666600])[/COLOR]
[COLOR=#000088]print[/COLOR] [COLOR=#008800]"Successfully sent email"[/COLOR]
[COLOR=#000088]except[/COLOR] [COLOR=#7F0055]SMTPException[/COLOR][COLOR=#666600]:[/COLOR]
[COLOR=#000088]print[/COLOR] [COLOR=#008800]"Error: unable to send email"[/COLOR]