What is the easiest way to setup a linux server to send mail?

I'm just about finished setting up the basics of my new ubuntu server - I don't have very much experience with Linux.

I only need to be able to send email from my server - but it seems to be really difficult to set it up.

I tried this answer, but I simply get the same error in my log as I did before I installed postfix...

sh: /usr/sbin/sendmail: not found 

I now have postfix installed, and have added the configuration file in my PHP config directory as that answer suggests - but I still encounter the same issue when sending emails with PHP.

What is the easiest way of setting this up to send emails through PHP with ubuntu server?


If you installed postfix, you can find the path of sendmail using:

$ sudo dpkg -L postfix | grep sendmail
/usr/sbin/sendmail
/usr/share/man/man1/sendmail.1.gz
/usr/lib/sendmail

So, sendmail should be installed as part of postfix package. Maybe, you need to make sure you have installed postfix successfully.


I use SSMTP - it is a simple package that can stand in place of sendmail for simple situations. It works on several systems, including Linux, FreeBSD and Windows (within Cygwin).

It is not a mail server (like feature-rich mail server sendmail) and does not receive mail, expand aliases or manage a queue.

One of its primary uses is for forwarding automated email (like system alerts) off your machine and to an external email address.

It's configuration is simple and is easy to use with gmail SMTP