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?
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/sendmailthat 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 asendmailprogram 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 programsendmail) 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
sendmailrequires you to invoke thesubprocessmodule which is somewhat clunky and also very dependent on things that are not part of Python. So basically there is no reason not to usesmtplib.