LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-28-2010, 02:14 AM   #1
chobong
Member
 
Registered: Jan 2010
Posts: 90

Rep: Reputation: 15
PHP Sendmail


Hi All

Im using sendmail on my Ubuntu server.
When I send an email with command line on the server, it still works fine.
But when I use sendmail with php, default it takes root@mydomain for sender(not my sender's email which i typed in) and I cant receive mail.

This is the log file
Jan 27 18:11:51 vn-local sm-mta[6085]: o0RABp3N006085: from=<root@vn-local.com>, size=344, class=0, nrcpts=1, msgid=<201001271011.o0RABp1g006084@vn-local.com>, proto=ESMTP, daemon=MSP-v4, relay=localhost [127.0.0.1]
Jan 27 18:11:51 vn-local sendmail[6084]: o0RABp1g006084: to=kelly.do@abc.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30127, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o0RABp3N006085 Message accepted for delivery)

Although stat=Sent, but I can't received the email.

Please help me!!!
Thanks all
 
Old 01-29-2010, 02:24 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,720

Rep: Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973
Quote:
Originally Posted by chobong View Post
Hi All

Im using sendmail on my Ubuntu server.
When I send an email with command line on the server, it still works fine.
But when I use sendmail with php, default it takes root@mydomain for sender(not my sender's email which i typed in) and I cant receive mail.

This is the log file
Jan 27 18:11:51 vn-local sm-mta[6085]: o0RABp3N006085: from=<root@vn-local.com>, size=344, class=0, nrcpts=1, msgid=<201001271011.o0RABp1g006084@vn-local.com>, proto=ESMTP, daemon=MSP-v4, relay=localhost [127.0.0.1]
Jan 27 18:11:51 vn-local sendmail[6084]: o0RABp1g006084: to=kelly.do@abc.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30127, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o0RABp3N006085 Message accepted for delivery)

Although stat=Sent, but I can't received the email.

Please help me!!!
Not to sound snotty, but you need to fix your program.

The PHP program running from a web page isn't running as a 'regular' user...it's running as root/wwwserver/whatever your web server is running as. So sendmail is picking up that UID when it's run. And you don't say how you're calling sendmail (via module? Perl script? shell_exec?), so it's hard to say what to do. But you'll have to explicitly specify the FROM address in your code, which sounds like isn't happening now.
 
Old 02-01-2010, 12:48 AM   #3
chobong
Member
 
Registered: Jan 2010
Posts: 90

Original Poster
Rep: Reputation: 15
Thanks TBOne!

I configured sendmail to change FROM default (root@vn-local.com to another email) and everything is ok.
 
  


Reply



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
php+ sendmail no good - python + sendmail ok nephish Linux - Networking 1 10-07-2005 01:19 PM
PHP and sendmail lost@sea Linux - Software 5 09-21-2005 09:16 AM
php sendmail... HELP! Doug86 Linux - Newbie 3 07-29-2005 09:09 AM
PHP/Sendmail Help dailyuser Programming 0 08-31-2004 10:35 AM
Sendmail and PHP Aldyn Linux - Newbie 0 06-02-2003 10:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:03 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration