from smtplib import SMTP as Client client = Client("localhost", "2525") r = client.sendmail('a@example.com', ['b@domain.tld'], """\ From: Anne Person To: Bart Person Subject: A test Message-ID: Hi Bart, this is Anne. """)