Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

Wanted: Service 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
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
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
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
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
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
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
you dont have a $from variable..?
 

dmgs11

New Member
Legacy Platinum Member
Joined
Nov 14, 2011
Messages
2
Reaction score
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
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
 

silentg

Level 8
Legacy Exclusive Member
Joined
Feb 4, 2010
Messages
2,306
Reaction score
284
You guys do know that this was a 8 year old thread.
 
Status
Not open for further replies.

Who has viewed this thread (Total: 1) View details

Who has watched this thread (Total: 3) View details

The Rule #1

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

Premium Members

Upcoming events

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators

Top Bottom