Knowledgebase: outmail
How do I set up outbound SMTP using Python?


How do I set up outbound SMTP using Python?
How do I use outMail in Python?


The following example of code assumes you have already got a fully functional webserver and Python installed and working.

Example code

from smtplib import SMTP
import datetime

debuglevel = 0
username = ""
password = "password"

smtp = SMTP()
smtp.connect('', 25)
smtp.login(username, password)

from_addr = "My Name<>"
to_addr = ""

subj = "Test email"  
date = "%d/%m/%Y %H:%M" )

message_text = "Hello\nThis is a test email\n\n"

msg = "From: %s\nTo: %s\nSubject: %s\nDate: %s\n\n%s"%( from_addr, to_addr, subj, date, message_text )

smtp.sendmail(from_addr, to_addr, msg)  

Summary of server details

Outgoing server

As provided in your signup email.

Outgoing server protocol


Outgoing server port

25, 587, 2525 or 8025

Authentication Type

Basic Authentication


As provided


As provided


(2 vote(s))
Not helpful

The Origin of this information may be internal or external to Prolateral Consulting Ltd. Prolateral makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Prolateral makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.