views:

670

answers:

3

I need to send email in delbian linux. How to send? I run my server on 256 MB linux box and I heard postfix and sendmail is overkill.

Recently I came across the ssmtp, that seems to be an executable, needs to be executed as a process and called through python using os modules.

alternatively, python already provides smtplib which is working fine with me.

What is the advantage of using ssmtp over python's smtplib?

+3  A: 

In a Python program, there is no advantage.

The only purpose of ssmtp is to wrap the SMTP protocol in the sendmail API. That is, it provides a program /usr/sbin/sendmail that accepts the same options, arguments, and inputs as the full-blown sendmail (though most of the options do nothing); but behind the scenes, instead of processing the email itself, it sends the message to an SMTP server. This is for systems that need to have a sendmail program present, perhaps because they don't understand SMTP - for example, I think older versions of PHP had this requirement, and even in recent versions it might still be easier to configure PHP to use the so-called sendmail interface (i.e. the program sendmail) than to use SMTP directly. (I haven't used PHP in a little while, I'm not sure about the current status)

However, in Python the situation is reversed: you have a builtin library that makes it easy to use SMTP directly, whereas using sendmail requires you to invoke the subprocess module which is somewhat clunky and also very dependent on things that are not part of Python. So basically there is no reason not to use smtplib.

David Zaslavsky
good information. thanks a lot
Krish
+2  A: 

Additionally, postfix is very easy to install in "satellite" mode, where all it does is queue and deliver email for you. Way easier than implementing your own email queue. Most decent package management systems will let you configure it this way.

Sharkey
+1  A: 

There are other lightweight SMTP senders, such as msmtp, the one I prefer.

But Postfix is fine for a 256 Mb machine. The good thing about a full MTA like Postfix is that it keeps the message and retries if the destination server is down. With smtplib and the server on a remote machine, you program now depends on the network...

bortzmeyer