LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 04-13-2007, 05:54 PM   #1
DukeLeto
Member
 
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:
Code:
<?
        $headers  = "MIME-Version: 1.0\r\n";
        $headers .= "Content-type: text/html; charset=iso-8859-1\n";
        $headers .= "From: Michael <michael@somewhere.com>\n";
        $to = ("michael@somewhere.com");
        $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@192.168.1.40

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

Also, another

Apr 13 13:57:18 mgmt postfix/smtp[23944]: CBB37BAC94: to=<to4451@elsewhere.com>, relay=mail.elsewhere.com[192.168.1.22]:25, delay=1, delays=0.01/0/1/0.01, dsn=5.3.0, status=bounced (host mail.elsewhere.com[192.168.1.22] said: 553 5.3.0 <to4451@elsewhere.com>... elsewhere.com 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?

Thanks,
Michael
 
Old 04-13-2007, 11:24 PM   #2
Berhanie
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
'-fuser@something.com' as the 5th argument to mail(). See here.
 
  


Reply


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


All times are GMT -5. The time now is 10:30 PM.

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