Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-13-2007, 05:54 PM   #1
Registered: Jan 2003
Location: Antarctica
Distribution: *watches the penguins pass by*
Posts: 56

Rep: Reputation: 15
PHP mail() sending as apache@ipaddress

I have scripts:
        $headers  = "MIME-Version: 1.0\r\n";
        $headers .= "Content-type: text/html; charset=iso-8859-1\n";
        $headers .= "From: Michael <>\n";
        $to = ("");
        $subject = "THIS IS A TEST!";
        $body = "TEST!!2";
        mail ($to, $subject, $body, $headers) or print "Could Not Send Mail";
Yet, my mail sends as apache@

Apr 13 13:57:16 mgmt postfix/smtp[23975]: 38C24BAB04: to=<>,[]:25, delay=0.09, delays=0.07/0/0.01/0, dsn=5.0.0, status=bounced (host[] said: 501 <apache@[]>: domain literals not allowed (in reply to MAIL FROM command))

Also, another

Apr 13 13:57:18 mgmt postfix/smtp[23944]: CBB37BAC94: to=<>,[]:25, delay=1, delays=0.01/0/1/0.01, dsn=5.3.0, status=bounced (host[] said: 553 5.3.0 <>... No such user here (in reply to RCPT TO command))

I for the life of me cannot figure out why. I am setting from in my headers for the php mail(), this is ALL linux, so setting sendmail_from in php.ini won't help, as that only works on windows.

Anyone have any ideas at all?

Old 04-13-2007, 11:24 PM   #2
Senior Member
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
You're setting the header from, but not the envelope from. You can set the envelope from by using sendmail -f, i.e. by giving
'' as the 5th argument to mail(). See here.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot send mail with mail() command in PHP 4.3.4, Apache 2.0.48, Mandrake Linux 10 arcanum Linux - General 3 06-27-2004 07:06 PM
Sending mail with PHP on linux machine through exchange on Windows server 2003 TVScoundrel Linux - Newbie 1 06-18-2004 02:22 PM
Sending mail with PHP on linux machine through exchange on Windows server 2003 TVScoundrel Linux - Networking 2 06-18-2004 01:02 PM
Sending mail with PHP and sendmail. davemar Linux - General 10 06-11-2004 05:48 PM
Form not sending mail using includes... PHP cadkins Programming 3 04-27-2004 07:38 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration