Categories
Python

Sending Mail Via Postfix: A perfect Python Example :)

I have been playing with Postfix for the last couple of days. I have already posted a perfect php class for sending email with attachments in a previous post. The Python example I posted earlier does the job for me but it was not perfect like the php one.

After digging a while, I found a nice way to do the same for python as well. I have just tested the codes and the result is perfectly what I desired 🙂

Here’s the code:

8 replies on “Sending Mail Via Postfix: A perfect Python Example :)”

This code (or the PHP version) isn’t exactly specific to postfix. All you need is a sendmail compatible mailer daemon installed in the system. All of the popular MTAs (postfix, exim, qmail etc) support the sendmail way of sending mail.

Thank you!

You solved a tricky problem, I would like to see how the other guy use sendmail with python.

 

Hi Masnun,

Thanks, nice code. Worked perfectly for my server running postfix.

Have a nice day

thanks that made me spot the email lib.

We can streamline things using more up-to-date code (python 3):

 

 

 

Comments are closed.