Skip to content Skip to sidebar Skip to footer

Sending Html Mail With Function

I've been working on this for ages and just can't find the issue. Hope somebody is so kind enough to help me out. I've made a function for my mailing script. The function is inside

Solution 1:

Why don't you have the email "send itself" by modifying try{} to include $mail->Send();?

Your "try" will become:

try
{
  $mail->IsSMTP(); 
  $mail->isHTML(true);
  $mail->SMTPDebug  = 0;                     
  $mail->SMTPAuth   = true;                  
  $mail->SMTPSecure = "STARTTLS";                 
  $mail->Host       = "mailout.one.com";      
  $mail->Port       = 587;             
  $mail->AddAddress($email);
  $mail->Username   ="joe@gmail.com";  
  $mail->Password   ="Password";            
  $mail->SetFrom("joe@gmail.com");
  $mail->AddReplyTo("joe@gmail.com");
  $mail->Subject    = $subject;
  $mail->Body     = $message;
  $mail->AltBody    = $message;
  $mail->Send();
  echo"Message Sent OK\n";
  } catch (phpmailerException $e) {
    echo$e->errorMessage(); //Pretty error messages from PHPMailer
  } catch (Exception$e) {
    echo$e->getMessage(); //Boring error messages from anything else!
  }

Post a Comment for "Sending Html Mail With Function"