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

php slowing my site?
Hi all,

I think that one of the reasons that my site doesn't work fast is that the code is ve

Help adding strtolower( to my in_array
strtolower i need to add it to this to work, iuno how.

Code: $moderators = array('Admin', 'ba

Can't shake the "Warning: include()" error
I've just uploaded my site to a new server and where I have PHP include tags in my HTML, the browser

values in array being escaped
I would like to submit some values - back to the same form for checking before processing...

The page should be expire when cilck back button
hi,
i'm new to php world.
i create user registration page.
when i submit it,data goes to my

retrieving policy name inside the function called by this particular policy
Hi there,

I've playing around with dbms_rls package, trying to set up some security repo

Simple MySQL script is not working
Hey guys,

Just familiarizing myself with PHP and MySQL. I am following along in the O'Reilly

php libs/ browsercap.in
ok i have a host that refuses to stay current. they control my php settings and libs. is there a way

getting a website's source code as a variable? How?
Hey guys, is there any way for me to get the source code of a website as a variable for me to work w

What exactly is net neatrality?
What exactly is it? I think it's anti-censorship and... stuff... but I don't really understand it

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