Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
    
Check your system logs (e.g. /var/log/mail.*) to find out what's happening to the mail. –  Michael Hampton Nov 27 '12 at 13:16
    
Thanks for the suggestion - I am at work which blocks the sftp port so I can't look in my server but will post back when I get home –  harryg Nov 27 '12 at 14:31
add comment

1 Answer

You either need postfix or sendmail. They server the same purpose and you cannot have both installed. Assuming that you continue to work with sendmail decide what mail from this machine will look like, eg user@domain.name. Observe that you are getting two errors from sendmail:

The first error is My unqualified host name (sergeserver) unknown, so make sure that an entry about sergeserver exists in /etc/hosts.

The second error that you are getting is unable to qualify my own domain name (sergeserver). Which means that the machine besides a "simple" host name (sergeserver in your case) must have a fully qualified name that makes it unique in the DNS system. So it will be helpful if you have the following entry in your /etc/hosts:

95.142.166.209 sergeserver sergeserver.domain.name

Since you seem to be working on a Debian or an Ubuntu system, sudo sendmailconfig will restart sendmail for you. Try it out and see what happens. If it is still not working, edit /etc/mail/sendmail.mc and add the following lines at the bottom:

LOCAL_CONFIG
Dmsergeserver
Djsergeserver.domain.name

sudo sendmailconfig and see what happens.

share|improve this answer
add comment

Your Answer

 
discard

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.