This should help you get Sendmail installed with basic configuration on Ubuntu.
- If sendmail isn't installed, install it:
sudo apt-get install sendmail
- Configure
/etc/hosts
file:nano /etc/hosts
- Make sure the line looks like this:
127.0.0.1 localhost yourhostname
- Run Sendmail's config and answer 'Y' to everything:
sudo sendmailconfig
- Restart apache
sudo service apache2 restart
I like such blabbering as @m-ric, just to say something ...
on a clean server, do not forget to check whether you need a php-mail:
$ sudo apt-get install php-mail
To be sure, restart the server and execute the configuration with the command:
$ sudo /usr/sbin/sendmailconfig
Checking from the console (with the -v switch being traced):
$ echo "test message" | sendmail -v [email protected]
You can also configure the settings in the php.ini: "...sendmail_path = /usr/sbin/sendmail -t -i"
I for example set up separately for each virtual host in my_vhost.conf:
<IfModule php[ver]_module>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
...many services, Google for example, require that a PTR record is specified, you can see this in the trace when the test is sent from the console with the key -v