Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

$ sudo dpkg -L postfix | grep sendmail

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

share|improve this answer

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

share|improve this answer
Perfect! Bravo! You're the man! Thank you for sharing. I am using this in a Ubuntu 12.04.2 LTS and it works like a charm! Thank you very much :D – Geppettvs D'Constanzo Aug 15 '13 at 22:30

I generally install exim4 on my Ubuntu servers. I'm assuming you have a centralized SMTP mail server, and can forward email to that.

Install the basic packages. apt-get install exim4

You'd want to install it with no local mail, and forward mail to your 'smarthost' that can accept mail from servers on that network segment.

In later releases, Ubuntu may not configure it at install time. In that case, you'll need to run the configuration steps with dpkg-reconfigure exim4-config.

To test it, simply run echo "test" | mail -s "test message"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.