Ive stumbled onto a rather strange problem, atleast I cant see why this
is happening. Im using phpMailer to send mails, and I have the following
straight forward code :

  $mail = new phpmailer();
  $mail->IsSendmail();
  $mail->From = '[EMAIL PROTECTED]';
  $mail->FromName = 'From Name';
  $mail->AddAddress('[EMAIL PROTECTED]');
  $mail->Subject = $header;
  $mail->Body = $body;

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()?

Maby it would be better to write like this :
   if(!$mail->Send()) {
      echo $lang_error['mailer_error'] . "<br>\n";
   } else if ($mail->Send()){
      // Why do I need this one???
   }

The above would in my belief send two mails, atleast my logic tells me that.
The strange part is that when looking at examples from
phpmailer.sourceforge.net
they use my initial loop aswell, not the "Why do I need this one???" part.
Im beginning to wonder if there are something mystical going on with either
my
code or our servers. ??


Hope someone understand what Im wondering about here, hehe.


-- 

-- 
Kim Steinhaug
-------------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
-------------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com
-------------------------------------------------------------------------

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to