Email logic not working


Posted on 16th Feb 2014 07:03 pm by admin

I would like to send an email using the php email() function then if it does execute i.e sends i would like to update a particular field in my db.however no matter how hard i try to the code seem to defy simply logic.here is the original code i have Code:
include_once("mailer.php");

$thesend=mail($toto1,$subject1,$message,$headers);

if($thesend)
{
$mail_went=1;
$_SESSION['msgstatus']= "Mail sent to ".$toto1."
";

}else{
$mail_went=0;
$_SESSION['msgstatus']= "Mail send failure - message not sent
";

}
the funny part is that the code executes the else and actually gives me the Mail send failure message yet i do receive the mail in my box????
However if i do change this to be like this Code: include_once("mailer.php");

$thesend=mail($toto1,$subject1,$message,$headers);

if(!$thesend)
{
$mail_went=1;
$_SESSION['msgstatus']= "Mail sent to ".$toto1."
";

}else{
$mail_went=0;
$_SESSION['msgstatus']= "Mail send failure - message not sent
";

}
........all works perfect what am i missing.The $message is an HTMl doc and the MIME and content-type are ok.
Damn

No comments posted yet

Your Answer:

Login to answer
243 Like 36 Dislike
Previous forums Next forums
Other forums

True way to see if action was successful?
If this is a good way to see if action was successful to continue:

Code: function changeGa

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

filesize() returns 0
I have a socket program that runs in an infinite loop, listening for connections, in this socket I h

Calculating n! using vector
#include
#include
#include

using

How to make a input/output field with multiple lines
Hello.
I put a input/output field on the screen but I could not change height of it. I need to

Get content from table into a list, without repeating.
Alright this is kinda an odd thing, so I need some help.

I have a table "quote" wit

FTP issues
Hi all,


I am currently facing some serious problems with a script and really need some ad

How to get the previous months last date....
Here's my wittle problem. I suck at working with dates.

So today is 10/20/2009, i need to fig

problem getting my contact form working
Yeah I know this is a pretty basic problem, but it's been a while since I've worked with PHP and I'm

Quick fix: Conditional statement with an array
Hi, I'm getting the temperature value off of the Environment Canada website along with the icon file

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash