Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have set up an ubuntu webserver, and need to be able to send email from forms via php. The server hosts multiple websites, and this issue persists for all of them.

When I have a form send to a domain name not hosted on the server (ie gmail, yahoo, etc) the email sends from the form without a problem.

When I have the form send to a that is hosted on the local server I receive a "user unknown" error. This is because I have not created the accounts on the server, but I do not plan to... the email is hosted elsewhere [gmail].

This is an example of what I am seeing in /var/mail/www-root...

The original message was received at Sun, 17 Oct 2010 18:39:41 -0700 from www-data@localhost

----- The following addresses had permanent fatal errors -----
(reason: 550 5.1.1 <>... User unknown)
(expanded from:

What is the proper way to set this up?

Thank you.

share|improve this question

In your add:


Or whatever is the SMTP outgoing server that Google has told you to use. Depending on your linux distribution produce and restart sendmail (in Debian this is done by running sendmailconfig).

EDIT: If the machine is not to accept any incoming email, it may be better to install nullmailer:

# apt-get install nullmailer
# dpkg-reconfigure nullmailer

EDIT: Since nullmailer cannot work with Gmail you can use ssmtp

share|improve this answer

If you don't care about which MTA you actually use, I recommend installing Postfix. It's fairly easy to configure and I use it on all of my web servers as well as the mail servers I maintain for clients.

sudo apt-get install postfix

If Postfix is already installed then instead run sudo dpkg-reconfigure postfix

Follow the menus, choose "Satellite system," stick to the defaults until you are asked for the SMTP Relay Host where you will enter a SMTP host you're allowed to use.

You may also have to put the following in /etc/postfix/

# Disable local delivery
mydestination =
local_recipient_maps =
local_transport = error:local mail delivery is disabled
share|improve this answer
I am not sure what SMTP host to use - I know Gmail is free, but we have to configure SSL and a bunch of other things to use? – naunu Oct 28 '10 at 22:26

While getting to postfix may be a good idea, but this kind of problem could also mean you are sending email from a blacklisted IP. Many DHCP assigned ISP IPs are in blacklist of

If you send email from sendmail it won't show the exact error and keep ranting annoying User Unknown error unless you enable some logging. However, with postfix is automatically tells you the exact problem such as

From any mail server

Mail server said: 550 Blacklisted in

From Google

status=bounced (host[] said: 550-5.7.1 [IP] The IP you're using to send mail is not authorized to 550-5.7.1 send email directly to our servers. Please use the SMTP relay at your 550-5.7.1 service provider instead. Learn more at 550 5.7.1

From Hotmail

status=bounced (host[] said: 550 DY-001 (COL0-MC4-F9) Unfortunately, messages from <IP> weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to

If you are using your own custom Mail server, you could perhaps fix it otherwise you need to get ISP to resolve this issue.


share|improve this answer

Your Answer


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.