Question
Test mail with PHP mail() ending up in 'dead.letter' (LAMP on Ubuntu 14.04 Droplet)
Hi,
I am new to Digital Ocean and Linux admin in general. Trying to migrate my site from shared hosting to Digital Ocean.
Just created an “One Click LAMP on 14.04” droplet for my old Codeigniter 2 site. Have transferred the files and pointed the domain to given IP. Seems everything is fine for now.
I have a page with contact from, which uses a PHP mail() function.
Recently I found out that its not working on DO server (was working fine on my shared hosting).
When I submit the form, instead of mail sent feedback message, my form reloads.
Tried to check that in developer console and found out that I am not getting any AJAX response
Exact Message:
TypeError: response is null
After some googling, I figured out that PHP mail() is compiled to use sendmail by default and was not installed on my droplet instance.
Followed the instruections from here:
[https://www.digitalocean.com/community/questions/php-mail-function-enable](http://)
Did this:
$ sudo apt-get install sendmail mailutils sendmail-bin
$ sudo nano /etc/hosts
-> 127.0.1.1 <my.domain> <my.domain> {just replaced the droplet name with my domain}
-> 127.0.0.1 localhost localhost.localdomain <my.domain>
$ sudo sendmailconfig
-> answered 'y" to everything
I have php script to test this with sender, receiver, message. Whenever I try sending test mail, I get message
/home/<uername>/dead.letter... saved message in /home/<username>/dead.letter
Can’t figure out what’s going on.
Need some clues and suggestions.
Thanks!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×