473,326 Members | 2,148 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,326 software developers and data experts.

mail() returns false but mail is sent

I'm doing a bit of work for a guy and on his system the mail() function
always returns false, but the mail is sent.

Anyone come across this? Any ideas what is causing it and how to fix
it?
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jan 9 '06 #1
6 3677
Geoff Berrow wrote:
I'm doing a bit of work for a guy and on his system the mail() function
always returns false, but the mail is sent.

Anyone come across this? Any ideas what is causing it and how to fix
it?

Sounds like there is a not missing. Got some code to show?
Jan 11 '06 #2
Message-ID: <fD****************@newsread1.news.pas.earthlink.n et> from
Dave Kelly contained the following:
Geoff Berrow wrote:
I'm doing a bit of work for a guy and on his system the mail() function
always returns false, but the mail is sent.

Anyone come across this? Any ideas what is causing it and how to fix
it?

Sounds like there is a not missing. Got some code to show?


Don't think so. My test script is very basic.

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";
// Send
if(mail('bl@*****.co.uk', 'My Subject', $message, 'From:
<bl@*****.co.uk>')){
echo "mail sent";
}

else{
echo "mail not sent";
}
?>

Mail is sent but the screen says mail not sent. Tested on another
server and it works just fine.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jan 11 '06 #3
Geoff Berrow wrote:
Message-ID: <fD****************@newsread1.news.pas.earthlink.n et> from
Dave Kelly contained the following:
Geoff Berrow wrote:
I'm doing a bit of work for a guy and on his system the mail()
function always returns false, but the mail is sent.

Anyone come across this? Any ideas what is causing it and how to
fix it?

Sounds like there is a not missing. Got some code to show?


Don't think so. My test script is very basic.

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";
// Send
if(mail('bl@*****.co.uk', 'My Subject', $message, 'From:
<bl@*****.co.uk>')){
echo "mail sent";
}

else{
echo "mail not sent";
}


Mail is sent but the screen says mail not sent. Tested on another
server and it works just fine.


is the problem server a windows server? Mail is handled slightly different
on a windows server.
Jan 11 '06 #4
Geoff Berrow wrote:
My test script is very basic.

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";
// Send
if(mail('bl@*****.co.uk', 'My Subject', $message, 'From:
<bl@*****.co.uk>')){
echo "mail sent";
}

else{
echo "mail not sent";
}
?>

Mail is sent but the screen says mail not sent. Tested on another
server and it works just fine.


What operating system is the script running on?

What are the mail configuration settings?

Don't copy them from php.ini; run this script instead:
<?php
$opts = array('SMTP', 'smtp_port', 'sendmail_from', 'sendmail_path');
foreach ($opts as $opt) {
echo $opt, ': [', ini_get($opt), "]<br/>\n";
}
?>

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jan 11 '06 #5
Message-ID: <sl*******************@ID-203069.user.individual.net> from
Pedro Graca contained the following:
What operating system is the script running on?
Linux.
What are the mail configuration settings?

Don't copy them from php.ini; run this script instead:
<?php
$opts = array('SMTP', 'smtp_port', 'sendmail_from', 'sendmail_path');
foreach ($opts as $opt) {
echo $opt, ': [', ini_get($opt), "]<br/>\n";
}
?>

Here's what I get:

SMTP: [localhost]
smtp_port: [25]
sendmail_from: []
sendmail_path: [/usr/sbin/sendmail -t -i]

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jan 12 '06 #6
Geoff Berrow wrote:
Message-ID: <sl*******************@ID-203069.user.individual.net> from
Pedro Graca contained the following:
What are the mail configuration settings?


sendmail_path: [/usr/sbin/sendmail -t -i]


Whoooooaa! diving into OT ... :)

Can you have a look at the sendmail logs?
(probably /var/log/mail.err, /var/log/mail.info, and /var/log/mail.log)
What happens if you do

/usr/sbin/sendmail -t -i < mailfile

where mailfile is, for example

---- cut ----
From: "some name" <ch*********@server.invalid>
To: "Geoff Berrow" <ca********@example.com>
Subject: test

test mail
---- cut ----
--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jan 12 '06 #7

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

Similar topics

6
by: pee2pee | last post by:
Hi, I have below code: <html> <head> <title>Contacting Worldpay, Please wait.......</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body...
2
by: Kindler Chase | last post by:
win2k server IIS5 CDO Mail Using CDO mail, I'm looping through several email addresses and sending emails. Everything works fine, however, I'd like to set a variable based on the success or not...
5
by: Stuart Palmer | last post by:
I have had for sometime a problem getting cdo.message to work, so I have given up on this and tried to test a form on my localhost machine using CDONTS again (this used to work) I have win 2000...
6
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I...
2
by: mike | last post by:
I've spent a couple of days on this and I'm to the "bang-my-head 'gainst the monitor and babble in tongues" mode. First - SuSE Pro 9.3, Linux 2.6.11.4-21.7, Apache 2.0.53, PHP 4.3.10 I have...
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 -------------------------------------------------------------------------------- ...
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...
11
by: shror | last post by:
Hi every body, Please I need your help solving my php mail() function problem that the code is appearing in the view source and I dont know whats the problem where I am using another page tto test...
5
by: Joker7 | last post by:
Hi, I use the script below to send a email from a contact form but it would be nice if the conformed sent page showed what was sent.Question how can I do this ? Thanks Chris <?php $mailto...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.