If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > mail() doesn't works but sendmail works ?¡!¿

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-11-03, 04:52
maverick2k2 maverick2k2 is offline
Registered User
 
Join Date: Sep 2003
Posts: 3
mail() doesn't works but sendmail works ?¡!¿

Hi to you all.
I have my server (red hat 8 fully updated) with the xampp project (apache 2.0.47, latest php, latest mysql, and so on...) installed.

I'm trying to use the php mail() function to send feedback from my site but i can't get it working. First of all I've disabled safe_mode (not a good idea) to avoid problems.

I've tested my code on other servers using xampp (on a windowsxp) and works OK (but the config is different from the redhat8 server), so it's not a coding problem.

Mail() function returns 1 if the sendinf was ok and I allways get a 1, so I suppose the sending was OK but.. NO. I never receive that e-mail. As mail() uses sendmail I tried to use sendmail from the command line and.. works perfect so ¿where is my problem? ¿permission matters? APache runs as user www

Some data:
[root@odyssea sbin]# pwd
/usr/sbin
[root@odyssea sbin]# ll send*
lrwxrwxrwx 1 root root 21 Jul 18 16:43 sendmail -> /etc/alternatives/mta
-rwxr-sr-x 1 root smmsp 3750315 Aug 26 13:58 sendmail.sendmail


[root@odyssea sbin]# ll /etc/alternatives/mta
lrwxrwxrwx 1 root root 27 Sep 1 09:14 /etc/alternatives/mta -> /usr/sbin/sendmail.sendmail

PHP.INI
[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only. So in unix doesn't matters
sendmail_from = me@localhost

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path =


Please, I need you help...

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 09-11-03, 21:01
bdl bdl is offline
Registered User
 
Join Date: Sep 2003
Location: ventura,ca,us
Posts: 8
Hmm. Can you post an example of your mail script? I know on the RH server our host uses, I have to pass an additional argument to mail(), which basically fools sendmail in sending it from a specific user. The fifth argument which is "-f mailaddress@somedomain.com". So our mail script makeup is like this:
PHP Code:
<?
$to 
"somejerk@somedomain.com";
$sub "Testing PHP";
$msg "Hey, read the subject line!";
$headers "From: Good Guy <youraddress@somedomain.com>\n";
$extra "-f [email]youraddress@somedomain.com[/email]";

if (!
$mail mail($to$sub$msg$headers$extra))
    die(
"Could not send email.");

echo 
"Mail sent.";
?>
I also notice you don't have your sendmail path specifically configured in the php.ini file; now, this isn't strictly necessary, but you should check your phpinfo() to verify where PHP thinks sendmail is.
Just a thought.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On