Bille

Snip PHPMailer

Apr 12th, 2011
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. <? php
  2.  
  3.     [-- cut --]
  4.  
  5.     // Setup SMTP
  6.     //
  7.  
  8.     $mdb_mail = new PHPMailer(true);
  9.     $mdb_mail->IsSMTP();
  10.     $mdb_mail->SMTPAuth     = $mdb_config['smtp_auth'];
  11.     $mdb_mail->Host     = $mdb_config['smtp_host'];
  12.     $mdb_mail->Username     = $mdb_config['smtp_user'];
  13.     $mdb_mail->Password     = $mdb_config['smtp_pass'];
  14.  
  15.     $mdb_mail->SetFrom($from_email, $from_name);
  16.     $mdb_mail->AddReplyTo($reply_to, $from_name);
  17.  
  18.     if (!$debug && !$mdb_config['debug_mode']) {
  19.         $mdb_mail->AddAddress($to_email, $to_name);
  20.  
  21.         if (isset($options['cc'])) {
  22.             $cc_list = explode(',', $options['cc']);
  23.             foreach ($cc_list as $cc) {
  24.                 $mdb_mail->AddCC(trim($cc));
  25.             }
  26.         }
  27.  
  28.         if (isset($options['bcc'])) {
  29.             $bcc_list = explode(',', $options['bcc']);
  30.             foreach ($bcc_list as $bcc) {
  31.                 $mdb_mail->AddBCC(trim($bcc));
  32.             }
  33.         }
  34.  
  35.     } elseif (isset($mdb_config['organization_debug_email']))
  36.         $mdb_mail->AddAddress($mdb_config['organization_debug_email'], 'Debug');
  37.     else
  38.         return false;
  39.  
  40.     $mdb_mail->Subject = $subject;
  41.     $mdb_mail->IsHTML(true);
  42.     $mdb_mail->Body = $html_mail;
  43.     $mdb_mail->SetWordWrap();
  44.     $mdb_mail->AltBody = $plain_mail;
  45.  
  46.     // Inline Images
  47.     $mdb_mail->AddEmbeddedImage($mdb_config['email_images'].$header,'header', $header);
  48.     $mdb_mail->AddEmbeddedImage($mdb_config['email_images'].$footer,'footer', $footer);
  49.  
  50.     $inline_image_array =
  51.         array(  'header' => $mdb_config['email_images'].$header,
  52.             'footer' => $mdb_config['email_images'].$footer );
  53.  
  54.     // Attachments
  55.     if (isset($options['attachments'])) {
  56.         $attachments_array = explode(':', $options['attachments']);
  57.         foreach ($attachments_array as $attachment) {
  58.             $mdb_mail->AddAttachment(trim($attachment));
  59.         }
  60.     }
  61.  
  62.     $mdb_mail->Send();
  63.  
  64.  
  65.     [-- cut --]
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment