Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 a simple script setup:

mail('', 'Hello World', 'Testing a message');

I cannot send email from my server to AOL accounts. The error details are below. GMail lets me send the I guess AOL is just a bit stricter.

   Starting tcpick 0.2.1 at 2009-08-03 22:25 UTC
    Timeout for connections is 600
    tcpick: reading from tcp_dump.pcap
    1      SYN-SENT >
    1      SYN-RECEIVED >
    1      ESTABLISHED > ESMTP mail_relay_in-mg05.6; Mon, 03 Aug 2009 18:25:34 -0400
    220-America Online (AOL) and its affiliated companies do not
    220-     authorize the use of its proprietary computers and computer
    220-     networks to accept, transmit, or distribute unsolicited bulk
    220-     e-mail sent from the internet.  Effective immediately:  AOL 
    220-     may no longer accept connections from IP addresses which 
    220      have no reverse-DNS (PTR record) assigned.
    250 HELP
    MAIL FROM:<www-data@com>
    250 OK
    1      FIN-WAIT-1 >
    2      SYN-SENT >
    1      FIN-WAIT-2 >
    1      RESET >
    3      SYN-SENT >
    tcpick: done reading from tcp_dump.pcap

    20 packets captured
    3 tcp sessions detected

Do you know how I can make the FROM parameter come out correctly? Setting the FROM header in the PHP mail function does not work.


This little hack is working but I would prefer to fix this issue outside of PHP.

mail('', 'Hello World', 'Testing a message', null,'');

I am super noob with mail servers

share|improve this question
up vote 1 down vote accepted

With AOL they often won't go through unless you fill out the form to get white listed. To change where the mail is coming from, edit the sendmail_path parameter in the php.ini file. This is mentioned in the php mail() doc under additional_parameters.

For Example:

sendmail_path = "/usr/sbin/sendmail -t -f"

You can also pass instead a parameter to the mail() function:

mail('', 'the subject', 'the message', null,

Lastly, you might find alternative mail package more flexible, such as PEAR MAIL package or msmtp, you can specify other smtp servers.

share|improve this answer
right now i am using phpmailer because the site is wordpress based and it comes stock. only issue is i have to change a wordpress file to create this setting which is bad practice. i would like to know how to fix this in postfix settings. it would be great to have postfix use the virtual host name as a host as well. – Tony Aug 3 '09 at 23:43

You want to change the envelope From: address, which is different from the From: header. See this comment in the mail() function's doc.

The envelope address depends on your MTAs configuration - in your case, 'www-data' is the user your script runs as, and 'com' is (part?) of your machine's hostname. Assuming you are on *nix, you can try to override the envelope address like this:

mail('', 'Hello World', 'Testing a message', null,'');

where is the envelope sender address you want to show.

If that works, and you have access to your php.ini file, you can set the envelope sender address there - see Kyle's post.

You might also want to have a look at your MTAs (sendmail, postfix) configuration - looks like it has a problem with your hostname setting. Changing php-s settings will fix it for php, but if something else (cron, logwatch) on your system wants to sent mail, it would be helpful to have a working MTA.

Edit after your comment: It's hard to suggest anything without knowing your mail server's config, but for a start, try the following:

myhostname =
mydomain =
myorigin = $mydomain
masquerade_domains =
share|improve this answer
yes, i would rather fix this for postfix and not just PHP. the postfix configuration file is huge though. all i really want is the FROM field to be "". I set myorigin = $mydomain but that did nothing. Maybe you could provide some direction? – Tony Aug 3 '09 at 23:19
my mail server's config is the default postfix installation. i haven't done anything fancy. adding these attributes to the config does not seem to change the envelope's FROM address – Tony Aug 4 '09 at 1:50

Try escaping the at sign.

mail('corgan1003\', 'Hello World', 'Testing a message');
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.