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:
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
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" [email protected]