Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.
NDD Camp 2024

Need help troubleshooting a PHP mail problem

Status
Not open for further replies.

Bob

Jedi Master
Joined
Apr 8, 2002
Messages
3,102
Reaction score
29
Feedback: 116 / 1 / 0
The PHP mail() function does not work on my server. I need somebody that is familiar with pHP installations and debugging to help me figure out what is wrong.

Please give me your price to help.

Thank you.

-Bob
 

moxsum

Level 5
Legacy Platinum Member
Joined
Jun 5, 2003
Messages
275
Reaction score
0
Feedback: 2 / 0 / 0
Ill try to help. Can you post your code that isnt working? thx.
 

Bob

Jedi Master
Joined
Apr 8, 2002
Messages
3,102
Reaction score
29
Feedback: 116 / 1 / 0
The mail function simply does not work. Here is the entire code that I am using:

<?php
$recipient = "[email protected]";
$subject = "Test from PHP";
$message = "Testing mail body";
mail("$recipient","$subject","$message");
?>

< html>< head>< title>< /title>< /head>
< body>
Testing mail via pHP< br>< br>
recipient: < ?php echo "$recipient"; ?>< br>
subject: < ?php echo "$subject"; ?>< br>
message: < ?php echo "$message"; ?>< br>

< /body>< /html>

NOTE: I put a space after the html tags so they woudl display correctly here. . .

I get no errors. The HTML displays fine with no PHP warnings.

In the php.ini file, the path to sendmail it correctly defined.

-Bob
 

Ciqala

Level 7
Legacy Platinum Member
Joined
Jul 22, 2002
Messages
872
Reaction score
0
Feedback: 0 / 0 / 0
if you put

$result = mail("$recipient","$subject","$message");

what does $result return? true or false?
 

Ciqala

Level 7
Legacy Platinum Member
Joined
Jul 22, 2002
Messages
872
Reaction score
0
Feedback: 0 / 0 / 0
from php.net comments on the mail() function...

This is a problem I ran into that really had me stumped for awhile.

I was using mail() to send messages from a bulletin board I created via a form in order to keep users email addresses private (read no email mining possible). Problem was some people were not getting the messages. After testing on MANY different email accounts I was beginning to get stumped.

It seems that some ISP's and servers require that the Return-Path header email address match the From email address in order for it to be passed onto the users account. By adding

-f [email protected]

as the last parameter in the mail function to the same as the From address everything started getting recieved as it should. Here's two examples.

mail($to, $subject, $body, $from);

resulted in some people not receiving the message.

but...

mail($to, $subject, $body, $from, "-f $from_email_address");

everyone got the message as intended.

Hope this helps someone else out as it had me totally baffled until I started comparing the full headers of my email messages.

perhaps this is the cause of your problems...
 

Bob

Jedi Master
Joined
Apr 8, 2002
Messages
3,102
Reaction score
29
Feedback: 116 / 1 / 0
Originally posted by Ciqala
if you put

$result = mail("$recipient","$subject","$message");

what does $result return? true or false?

Ciq: I tried that previously and it was not returning ANYTHING..

At any rate, the problem was SOLVED.

The path to sendmail in the php.ini file was /usr/sbin/sendmail.

Apparantly, it needed the -t -i switches. All is good in mailville now :D

-Bob
 

moxsum

Level 5
Legacy Platinum Member
Joined
Jun 5, 2003
Messages
275
Reaction score
0
Feedback: 2 / 0 / 0
you dont have a $from variable..?
 

dmgs11

New Member
Legacy Platinum Member
Joined
Nov 14, 2011
Messages
2
Reaction score
0
Feedback: 0 / 0 / 0
I am also having some issues with my PHP mail from and tried this solution but had no luck. Wondering if you could help?
 

Bernadette

Level 1
Legacy Platinum Member
Joined
Nov 16, 2011
Messages
6
Reaction score
0
Feedback: 0 / 0 / 0
We can help you in that. Could you give me your contact information so we can talk about it easily. Hoping to hear from you!

Regards,
Bernadette
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Sedo - it.com Premiums

IT.com

Premium Members

AucDom
UKBackorder
Be a Squirrel
MariaBuy

New Threads

Our Mods' Businesses

URL Shortener
UrlPick.com

*the exceptional businesses of our esteemed moderators

Top Bottom