[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/cron/ -> send_mail.php (source)

   1  <?php
   2  ////////////////////////////////////////////////////
   3  // PHPMailer - PHP email class
   4  //
   5  // Class for sending email using either
   6  // sendmail, PHP mail(), or SMTP.  Methods are
   7  // based upon the standard AspEmail(tm) classes.
   8  //
   9  // Copyright (C) 2001 - 2003  Brent R. Matzelle
  10  //
  11  // License: LGPL, see LICENSE
  12  ////////////////////////////////////////////////////
  13  
  14  /**
  15   * PHPMailer - PHP email transport class
  16   * @package PHPMailer
  17   * @author Brent R. Matzelle
  18   * @copyright 2001 - 2003 Brent R. Matzelle
  19   */
  20  
  21  
  22  //file modified by richie
  23  
  24  
  25  require ("class.smtp.php");
  26  require ("class.phpmailer.php");
  27  require_once  'include/utils/CommonUtils.php';
  28  
  29  function sendmail($to,$from,$subject,$contents,$mail_server,$mail_server_username,$mail_server_password,$filename,$smtp_auth='')
  30  {
  31    $mail = new PHPMailer();
  32    $mail->Subject = $subject;
  33      $mail->Body    = $contents;//"This is the HTML message body <b>in bold!</b>";
  34  
  35      $initialfrom = $from;
  36  
  37      $mail->IsSMTP();                                      // set mailer to use SMTP
  38      //$mail->Host = "smtp1.example.com;smtp2.example.com";  // specify main and backup server
  39      $mail->Host = $mail_server;  // specify main and backup server
  40      if($smtp_auth == 'true')
  41          $mail->SMTPAuth = true;
  42      else
  43          $mail->SMTPAuth = false;
  44      $mail->Username = $mail_server_username ;//$smtp_username;  // SMTP username
  45      $mail->Password = $mail_server_password ;//$smtp_password; // SMTP password
  46      $mail->From = $from;
  47      $mail->FromName = $initialfrom;
  48      $mail->AddAddress($to);                  // name is optional
  49      $mail->AddReplyTo($from);
  50      $mail->WordWrap = 50;                                 // set word wrap to 50 characters
  51      $mail->IsHTML(true);                                  // set email format to HTML
  52      
  53      $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
  54  //    $mail->Sender= getReturnPath($mail->Host);
  55      if(!$mail->Send()) 
  56      {
  57         echo "Message could not be sent. <p>";
  58         echo "Mailer Error: " . $mail->ErrorInfo;
  59         exit;
  60      }
  61  
  62  }
  63  ?>


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1