Thursday, August 19, 2010

anonymous emailing for mailing lists that expose email addresses

#!/usr/bin/python

import smtplib
SERVER = "your.smtp.server"

FROM = "joe@example.com"
TO = ["mailinglist@exposes.emails.com"] # must be a list


SUBJECT = "my question to the gurus"
TEXT = """

How do I send a message to the mailing list without exposing my email address to 
spambots?

cheers,

j.


----
To hide my email address from spam-bots, this message was sent with a false sender address using Python's smtplib.

"""

# Prepare actual message

message = """\
From: %s
To: %s
Subject: %s

%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)

# Send the mail

server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, message)
server.quit()