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 unable to sent email
Hi, guys, I try to send a email through php but unfortunately the mail unable to sent. Here is my co

Check before inserting in DB ???
This is my code
---------------
if ( $_POST ['Submit'])
{{
$username = $_POST ['usernm

need help in dynamic select menu in php
hi i have created a dynamic select menu using php. i have a problem in that which is when the user s

list files from folder, only one for each date
I have many files in a folder and wish to only list one of each date

these are the file names

Using cURL to PUT
Can somebody help with the correct php code to make a cURL PUT request. Here is a sample of code bel

IMAGE - SERVER SIDE scripting help...
How to receive pixel data of an image and buid a bitmap file on the server using the HTTP POST metho

TemplatePower & AJAX
Hi all,



I'm currently implementing some AJAX features in my PHP-framework (which is b

When i am Canseling the Billing Document in VF11 I am getting Shortdump
Hi Experts

When i am Canseling the Billing Document in VF11 I am getting Shortdump.

How to add functionality to a simple php calender?
Hello everyone,

I have just finished creating a simple php calander. Can someone point

Confused with Loop
guys, i got confused with Looping...this is the case

I have 3 stocks, let say "Stock A&q

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