473,394 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

php mail() issues

Apologies if this has been covered before - please slap me and point me in
the right direction if so - I've limited experience of PHP so possibly
missed something obvious

System is a Fedora core 5 system with Apache, PHP 5.1.4 and sendmail 8.13,
more or less a clean install. Sendmail has been configured to point to my
ISP provider, masqerade mail and send via them. This works fine, mail comes
through with the correct headers if I invoke mail from the linux command
prompt.

Cannot get mailing functions from Wordpress 2.2 working. Looking through
the code, I see it uses mail()

Trying a real simple example like this...

<? phpinfo();
mail('m***@myaddress.com','test','message'); ?>

also fails to work - the php info page is put up as expected but no bounced
mail, no mail comething through, nothing. Is this the correct way of doing
things - should mail be coming through with the code above? php.ini appears
to be set up correctly to point to seendmail - has the right path, has r-x
permission on the binary etc.

Thanks in advace.

Chris.
May 30 '06 #1
5 1538
On Tue, 30 May 2006 11:46:33 -0700, Michael Vilain wrote:
In article <ae*****************************@40tude.net>,
Chris <ng**@chris-street.demon.co.uk> wrote:
Apologies if this has been covered before - please slap me and point me in
the right direction if so - I've limited experience of PHP so possibly
missed something obvious

System is a Fedora core 5 system with Apache, PHP 5.1.4 and sendmail 8.13,
more or less a clean install. Sendmail has been configured to point to my
ISP provider, masqerade mail and send via them. This works fine, mail comes
through with the correct headers if I invoke mail from the linux command
prompt.

Cannot get mailing functions from Wordpress 2.2 working. Looking through
the code, I see it uses mail()

Trying a real simple example like this...

<? phpinfo();
mail('m***@myaddress.com','test','message'); ?>

also fails to work - the php info page is put up as expected but no bounced
mail, no mail comething through, nothing. Is this the correct way of doing
things - should mail be coming through with the code above? php.ini appears
to be set up correctly to point to seendmail - has the right path, has r-x
permission on the binary etc.

Thanks in advace.

Chris.


What's the setting for "sendmail_path" in your php.ini file?


/usr/sbin/sendmail -t -i

You can see the entire output here if that helps any more.

http://80.176.79.35/phpinfo.php

Thanks.
May 30 '06 #2
On Tue, 30 May 2006 12:26:14 -0700, Michael Vilain wrote:

What's the setting for "sendmail_path" in your php.ini file?
/usr/sbin/sendmail -t -i

You can see the entire output here if that helps any more.

http://80.176.79.35/phpinfo.php

Thanks.


And what happens when you type

/usr/sbin/sendmail -t -i ma**@myaddress.com
Subject: test
message
^D

in a shell?


That works fine, also works if I run mail from the shell and send a mail
from in there. I think that sendmail is setup OK (but could be wrong)
If that fails, try using

/usr/sbin/sendmail -t -v -i

instead.


Do you mean from the command line or modify the setting in php.ini? I've
changed it in php.ini - still no joy I'm afraid.

I don't need any extra rpm's for my PHP installation do I? My understanding
was that all I needed was the base php for mail - I have that and php-mysql
for the database backend
May 30 '06 #3
On Tue, 30 May 2006 16:05:31 -0700, Michael Vilain wrote:
In article <11*****************************@40tude.net>,
Chris <ng**@chris-street.demon.co.uk> wrote:
On Tue, 30 May 2006 12:26:14 -0700, Michael Vilain wrote:
>
> What's the setting for "sendmail_path" in your php.ini file?

/usr/sbin/sendmail -t -i

You can see the entire output here if that helps any more.

http://80.176.79.35/phpinfo.php

Thanks.

And what happens when you type

/usr/sbin/sendmail -t -i ma**@myaddress.com
Subject: test
message
^D

in a shell?
That works fine, also works if I run mail from the shell and send a mail
from in there. I think that sendmail is setup OK (but could be wrong)

If that fails, try using

/usr/sbin/sendmail -t -v -i

instead.


Do you mean from the command line or modify the setting in php.ini? I've
changed it in php.ini - still no joy I'm afraid.

I don't need any extra rpm's for my PHP installation do I? My understanding
was that all I needed was the base php for mail - I have that and php-mysql
for the database backend


I'm running php on a Macintosh, so I can't comment on your specific
setup. When you say "it doesn't work", what happens? What status does
mail("ma**@myaddress.com","subject", "body") return? What's in your log
for sendmail traffic, where ever you have it configured? Is it just not
working from inside php or does it actually go to sendmail, then fail?
What about the http log file for touching that page?


I don't think it was even getting as far as sendmail. Nothing in the logs,
and no error codes etc were returned. In order to see if there was a
problem I uninstalled PHP and then reinstalled all the required RPM's and
libraries - it now seems to work just fine and dandy. Most bizzare - still
no idea *why* it didn't work!

Thanks for all your help and encouragement though - I was ready to revert
back to my old windows box to run this until I found the answer!
[just some SWAGs...]

May 31 '06 #4
Chris wrote:
<snip>
Cannot get mailing functions from Wordpress 2.2 working. Looking through
the code, I see it uses mail()

<snip>

FWIW, there was a bug in mail() function and I don't think it's get
fixed. So, when sending mail with mail() function, it will get rejected
because of syntax error when sensitive servers receive it (eg, Yahoo).
So, try sending mail to different domains.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jun 4 '06 #5

Chris wrote:
[snip]
Trying a real simple example like this...

<? phpinfo();
mail('m***@myaddress.com','test','message'); ?>


Hi Chris.

I had problems with this also. Don't know if my solution will work or
not, but. Here is the code I used. Note that it is pieces of stuff
that I played with until it worked. Your mileage may vary.
<?php
include("DB.php");
.....
$MailTo = 'e********@domainname.tld';
$Subject = 'Some subject here';
$MailBody = 'What ever is the text you wish to send';
$headers = "From: me@mydomain.tld";
.....
?>
I fussed with this for a few hours until I found that 'header' stuff.
I then wrapped it in an 'if' statement.

if(mail($MailTo, $Subject, $MailBody, $headers) ) {
do something here.
} else {
oooops. do something drastic here
}

Hope that helps

todh

Oh FC5, php 5.14, sendmail 8.13.latest

Jun 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
25
by: abhinav | last post by:
Hello guys, I am a novice in python.I have to implement a full fledged mail server ..But i am not able to choose the language.Should i go for C(socket API) or python for this project? What are the...
4
by: | last post by:
Hi all, We are using the Asp.Net SMTP Client to send email via our Exchange 2003 SP2 Server. When trying to send email to a local recipient I am getting the following error:- Server:...
2
by: Goran Djuranovic | last post by:
Hi all, When sending mail from within a windows service I get this exception: "The specified procedure could not be found" at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) at...
3
by: eitan | last post by:
אני מעוניין לשלוח דואר אלקטרוני בתוכנת Windows Outlook 2003 אבל לא מעונין שהאדם שמקבל את הדוא"ל יראה את השם שלי ב-FROM האם יש אפשרות??
2
by: suekinch | last post by:
What is the code to send mail/feedback back to the administrator of a site. The code I am using is coming up with an error saying SmtpMail 3 arguments. I also have issues transferring a...
2
by: =?Utf-8?B?TWljaGFlbCBkZSBWZXJh?= | last post by:
To all, I was wondering if someone has sample VB.NET code that will help me send rows of a gridview into a body section of an e-mail. My goal is to present multiple rows within a gridview to a...
2
by: Dave | last post by:
Hi, When you create buttons from the wizard you can go on report options and select mail report. This sends a report in a chosen format to the mail software as an attachment. There are two...
3
uranuskid
by: uranuskid | last post by:
Hey folks, I was going to include a contact form on my website. Well, in the first place that seemed an easy thing to do with a form that prompts a PHP file validating the input vaiables and using...
2
by: lionel | last post by:
Hi, The HTML of my website is produced in UTF-8. I've got a contact form with a simple textearea. When I send this text : ---------------- This is some text with a second line...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.