Getting sendmail to install/work for using php mail()
- by harryg
I'm running WordPress on a Ubuntu VPS. When WordPress tries to send an email like a password reset or registration email it never gets delivered. WordPress uses php's mail() function.
I figure it's not working as my VPS didn't have sendmail installed. So I went into SSH and installed it with sudo apt-get install sendmail which appeared to succeed.
Following more googled advice I edited the php.ini file to have the sendmail path.
I located it as being /usr/sbin/sendmail which I believe is typical for many *nix servers. To check I browsed to this directory on FTP. The "sendmail" directory appears to be a shortcut. Is this correct/expected?
Either way the php mail function is not working. I have created a phpinfo file and a test mail php file which contains just a mail() function with my email as the recipient.
Note: my VPS doesn't yet have a domain, just an IP address. Would this affect sendmail functionality?
My phpinfo is here for your reference: http://95.142.166.209/phpinfo.php
Do I also need postfix? I don't think I have it...
Here is some of the mail log. I executed the mail function towards the end:
Nov 27 18:41:02 sergeserver sm-msp-queue[5450]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 19:00:01 sergeserver sm-msp-queue[5497]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 19:01:01 sergeserver sm-msp-queue[5497]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 19:20:01 sergeserver sm-msp-queue[5532]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 19:21:01 sergeserver sm-msp-queue[5532]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 19:40:01 sergeserver sm-msp-queue[5568]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 19:41:01 sergeserver sm-msp-queue[5568]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 20:00:01 sergeserver sm-msp-queue[5605]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 20:01:01 sergeserver sm-msp-queue[5605]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 20:20:01 sergeserver sm-msp-queue[5641]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 20:21:01 sergeserver sm-msp-queue[5641]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 20:40:01 sergeserver sm-msp-queue[5675]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 20:41:01 sergeserver sm-msp-queue[5675]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 21:00:01 sergeserver sm-msp-queue[5712]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 21:01:01 sergeserver sm-msp-queue[5712]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 21:20:02 sergeserver sm-msp-queue[5747]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 21:21:02 sergeserver sm-msp-queue[5747]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 21:40:01 sergeserver sm-msp-queue[5782]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 21:41:01 sergeserver sm-msp-queue[5782]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 22:00:01 sergeserver sm-msp-queue[5831]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 22:01:01 sergeserver sm-msp-queue[5831]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 22:20:01 sergeserver sm-msp-queue[5866]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 22:21:01 sergeserver sm-msp-queue[5866]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 22:37:19 sergeserver sendmail[5903]: My unqualified host name (sergeserver) unknown; sleeping for retry
Nov 27 22:38:19 sergeserver sendmail[5903]: unable to qualify my own domain name (sergeserver) -- using short name
Nov 27 22:38:19 sergeserver sendmail[5903]: qARLcJYI005903: from=adminftp, size=158, class=0, nrcpts=0, msgid=<201211272138.qARLcJYI005903@sergeserver>, relay=adminftp@localhost