[snip]
Then to send the mail we use this :
if(!$mail->Send()) {
echo $lang_error['mailer_error'] . "<br>\n";
}
As you see above, Ive dropped the "what if all goes well" loop, since I
believe that the $mail->Send() is initiaded in the first statement....
For some reason the above results in a blank mail, no $body at all,
rest is fine. However, if I include a dummy for if all goes well :
if(!$mail->Send()) {
echo $lang_error['mailer_error'] . "<br>\n";
} else {
// Why do I need this one???
}
What I dont understand is why do I need the last else statement? Isnt
the
result of $mail->Send() completed if I only check for !$mail->Send()?
[/snip]
This is fairly standard in programming languages all the way around. The
'else', even if a dummy, is the antithesis of the NOT statement. Think
of it this way ...
----my code----
if($mail->Send()){
// sends mail because $mail->Send evaluates to TRUE
} else {
// evaluates to FALSE
echo $lang_error['mailer_error'] . "<br>\n";
}
----my code----
----your code----
----my comments----
if(!$mail->Send()) {
// if $mail->Send is FALSE 'if' evaluates TRUE
echo $lang_error['mailer_error'] . "<br>\n";
} else {
// $mail->Send evaluated to TRUE, without 'else' it is has no
place to 'act'
// Why do I need this one???
}
----your code----
I hope that helps, may not be crystal clear.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php