Sendmail PHP integration problem – PHP

  php

Q(Question):

Hi all,
I am using a simple php script to send a mail.

<?php
if (mail($to, $sub, $message, $from))
echo "sent mail successfully<br>\n";
?>

It GOES $to = "me@localhost.localdomain"

But NOT $to = "so*****@some.other.domain"

I use following configuration in php.ini
sendmail_path = "sendmail -v -t -i"

so I see "successfully delevery acceptance" in both case at verbose
messages.

However I CAN SEND messages to BOTH address successfully USING
telnet localhost 25

So what I feel is sendmail configuration works properly. But there is
a problem in interfacing sendmail and php.

Please help me to solve it out.

Thanks in advance – SB

A(Answer):

can you post a bit more of your code?


Mike Bradley
http://www.gzentools.com — free online php tools
"Sumith Bandula" <su****@cse.mrt.ac.lk> wrote in message
news:7a*************************@posting.google.co m…

Hi all,
I am using a simple php script to send a mail.

<?php
if (mail($to, $sub, $message, $from))
echo "sent mail successfully<br>\n";
?>

It GOES $to = "me@localhost.localdomain"

But NOT $to = "so*****@some.other.domain"

I use following configuration in php.ini
sendmail_path = "sendmail -v -t -i"

so I see "successfully delevery acceptance" in both case at verbose
messages.

However I CAN SEND messages to BOTH address successfully USING
telnet localhost 25

So what I feel is sendmail configuration works properly. But there is
a problem in interfacing sendmail and php.

Please help me to solve it out.

Thanks in advance – SB

A(Answer):

Mike Bradley wrote:

can you post a bit more of your code?

In my real program I use bit complex set of codes. However after
realizing the problem I tested it with the given few lines of code. So
I don’t have any more codes for this, but here is my real lines of
code.

<?php
if (mail("su****@localhost.localdomain", "test", "test", "From:
su****@localhost.localdomain"))
echo "Email 1 sent<br>\n";

if (mail("su****@cse.mrt.ac.lk", "test", "test", "From:
su****@cse.mrt.ac.lk"))
echo "Email 2 sent<br>\n";
?>

I get both "Email 1 sent" and "Email 2 sent" messages, but second mail
doesn’t delever.

Anyhow I can send a mail to second address by TELNETing port 25.

Thanks a lot for your concern – SB

A(Answer):

"Sumith Bandula" <su****@cse.mrt.ac.lk> wrote in message
news:7a*************************@posting.google.co m…

It GOES $to = "me@localhost.localdomain"

What about php.ini and variable "sendmail_from"?

uncle Ramp

A(Answer):

You need to check your PHP.ini and make sure the
sendmail from variable is set to a valid address.
____________________________________
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
DigitallySmooth Inc. | Quick Site Studio
"Sumith Bandula" <su****@cse.mrt.ac.lk> wrote in message news:7a*************************@posting.google.co m…
Hi all,
I am using a simple php script to send a mail.

<?php
if (mail($to, $sub, $message, $from))
echo "sent mail successfully<br>\n";
?>

It GOES $to = "me@localhost.localdomain"

But NOT $to = "so*****@some.other.domain"

I use following configuration in php.ini
sendmail_path = "sendmail -v -t -i"

so I see "successfully delevery acceptance" in both case at verbose
messages.

However I CAN SEND messages to BOTH address successfully USING
telnet localhost 25

So what I feel is sendmail configuration works properly. But there is
a problem in interfacing sendmail and php.

Please help me to solve it out.

Thanks in advance – SB

A(Answer):

"onu Ramp" <imeloom%20hot.ee> wrote in message news:<40*********************@diablo.uninet.ee>…

What about php.ini and variable "sendmail_from"?

As I know "sendmail_from" and "SMTP" are useful only in Windows.

I just commented it since I am using Linux.

Anyhow I tried with few options of these values as well. But couldn’t succeed – SB

A(Answer):

su****@cse.mrt.ac.lk (Sumith Bandula) wrote in message news:<7a*************************@posting.google.c om>…

<?php
if (mail($to, $sub, $message, $from))
echo "sent mail successfully<br>\n";
?>
It GOES $to = "me@localhost.localdomain"
But NOT $to = "so*****@some.other.domain">
Please help me to solve it out.

Finally I could solve it out. Thanks for all of you concern the
problem. Here is the simple change I did for the benifit of others who
might come across same type of problem.

Just add following line to the end of sendmail.mc file mostly
locateted in /etc/mail/

Cwmachinename.your.domain.name

Note that ‘Cw’ at the begining of above line.
Then run:

make -C /etc/mail

to reconfigure sendmail.cf. This might differ in different versions.

Finally thanks to all of you again – SB

LEAVE A COMMENT