I want to write an email sending script in Python. Most email programs have to connect to existing servers, like Gmail or Hotmail. I want my script to work independantly of those servers and just be able to send email itself (without having to logon anywhere else). The reason for this is because most email servers (like Yahoo) limit what you can do, such as controlling the sender address or sending certain types of files. So I wanted to write my own script to get around that. So what do I do? Where do I begin learning how to do this? Do I have to write my own server? If I do, how is that done?
3 Answers
You need an MTA (a.k.a. mail transfer agent), whether it's local or remote. SMTP servers talk to each other to deliver the mail through — if you don't want to connect to the remote one, you need to run a local one. Look into Postfix or exim — just be careful not to allow random people to connect to it. Go to Server Fault if you need help with configuring them.
This is language-agnostic, BTW.
Comments
The email-module of Python should give you a good starting point. Btw this was the first hit when googling Python email.
2 Comments
user845902
Yeah, I looked at a lot of places on the Internet. Almost all of them require me to log on to existing servers to send email, but I suppose that will get me started.
Björn Pollex
@user: smtplib can be used to send email directly to any SMTP-listener.