harryg
harryg

Reputation: 24077

Does sendmail need a domain name to function?

I have a VPS running WordPress and have tried to install sendmail to enable the php mail() function which WordPress uses. WordPress emails were not being received so I created a test php file containing the mail function to send me a test email. When run this php file hangs for around 30s before loading with no error messages. I checked my mail logs and see quite a few of these:

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

Could this be a cause of the mail function not working? As explained in the title my server does not yet have a domain name. I will be pointing my domain to the server this evening but have been developing using the VPS's IP in the meantime.

I have ensured my php.ini contains the sendmail path line

Update: I have replaced sendmail with postfix as I here it is easier to set up. I have put the hostname sergedenimes.com in my hosts and hostname files The mail function is still not working. Here are some of the latest logs:

Nov 28 21:20:01 sergedenimes postfix/qmgr[2878]: 1834F2C1EE: from=<[email protected]>, size=689, nrcpt=1 (queue active)
Nov 28 21:20:02 sergedenimes postfix/local[3171]: 1834F2C1EE: to=<[email protected]>, orig_to=<root>, relay=local, delay=1.1, delays=0.03/0.02/0/1, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Nov 28 21:20:02 sergedenimes postfix/qmgr[2878]: 1834F2C1EE: removed
Nov 28 21:23:06 sergedenimes postfix[3216]: error: to submit mail, use the Postfix sendmail command
Nov 28 21:23:06 sergedenimes postfix[3216]: fatal: the postfix command is reserved for the superuser

Upvotes: 0

Views: 2676

Answers (1)

S&#233;bastien Renauld
S&#233;bastien Renauld

Reputation: 19672

The server's FQDN needs to be fully qualified (hence the name: Fully Qualified Domain Name). Even if it is downright false, for testing purposes, set it to something resolvable for the time being in sendmail and on the PHP default domain for sendmail.

And, if your server doesn't have an IP address, you've got a much bigger issue than a sendmail bug - having a server that thinks it's on the internet without being on it! :-)

Upvotes: 1

Related Questions