当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPMailer::IsQmail方法代码示例

本文整理汇总了PHP中PHPMailer::IsQmail方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::IsQmail方法的具体用法?PHP PHPMailer::IsQmail怎么用?PHP PHPMailer::IsQmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPMailer的用法示例。


在下文中一共展示了PHPMailer::IsQmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 /**
  * Miscellaneous calls to improve test coverage and some small tests
  */
 function test_Miscellaneous()
 {
     $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
     $this->Mail->AddCustomHeader('SomeHeader: Some Value');
     $this->Mail->ClearCustomHeaders();
     $this->Mail->ClearAttachments();
     $this->Mail->IsHTML(false);
     $this->Mail->IsSMTP();
     $this->Mail->IsMail();
     $this->Mail->IsSendMail();
     $this->Mail->IsQmail();
     $this->Mail->SetLanguage('fr');
     $this->Mail->Sender = '';
     $this->Mail->CreateHeader();
     $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
     $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
     //Test pathinfo
     $a = '/mnt/files/飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME), '/mnt/files', 'Dirname path element not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
     $a = 'c:\\mnt\\files\\飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], 'c:\\mnt\\files', 'Windows dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
 }
开发者ID:rohitvineet,项目名称:PHP-Online-Shop,代码行数:35,代码来源:phpmailerTest.php

示例2: send

 /**
  * send an email
  *
  * @param string $toaddress
  * @param string $toname
  * @param string $subject
  * @param string $mailtext
  * @param string $fromaddress
  * @param string $fromname
  * @param bool $html
  */
 public static function send($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '')
 {
     $SMTPMODE = OC_Config::getValue('mail_smtpmode', 'sendmail');
     $SMTPHOST = OC_Config::getValue('mail_smtphost', '127.0.0.1');
     $SMTPAUTH = OC_Config::getValue('mail_smtpauth', false);
     $SMTPUSERNAME = OC_Config::getValue('mail_smtpname', '');
     $SMTPPASSWORD = OC_Config::getValue('mail_smtppassword', '');
     $mailo = new PHPMailer(true);
     if ($SMTPMODE == 'sendmail') {
         $mailo->IsSendmail();
     } elseif ($SMTPMODE == 'smtp') {
         $mailo->IsSMTP();
     } elseif ($SMTPMODE == 'qmail') {
         $mailo->IsQmail();
     } else {
         $mailo->IsMail();
     }
     $mailo->Host = $SMTPHOST;
     $mailo->SMTPAuth = $SMTPAUTH;
     $mailo->Username = $SMTPUSERNAME;
     $mailo->Password = $SMTPPASSWORD;
     $mailo->From = $fromaddress;
     $mailo->FromName = $fromname;
     $mailo->Sender = $fromaddress;
     $a = explode(' ', $toaddress);
     try {
         foreach ($a as $ad) {
             $mailo->AddAddress($ad, $toname);
         }
         if ($ccaddress != '') {
             $mailo->AddCC($ccaddress, $ccname);
         }
         if ($bcc != '') {
             $mailo->AddBCC($bcc);
         }
         $mailo->AddReplyTo($fromaddress, $fromname);
         $mailo->WordWrap = 50;
         if ($html == 1) {
             $mailo->IsHTML(true);
         } else {
             $mailo->IsHTML(false);
         }
         $mailo->Subject = $subject;
         if ($altbody == '') {
             $mailo->Body = $mailtext . OC_MAIL::getfooter();
             $mailo->AltBody = '';
         } else {
             $mailo->Body = $mailtext;
             $mailo->AltBody = $altbody;
         }
         $mailo->CharSet = 'UTF-8';
         $mailo->Send();
         unset($mailo);
         OC_Log::write('mail', 'Mail from ' . $fromname . ' (' . $fromaddress . ')' . ' to: ' . $toname . '(' . $toaddress . ')' . ' subject: ' . $subject, OC_Log::DEBUG);
     } catch (Exception $exception) {
         OC_Log::write('mail', $exception->getMessage(), OC_Log::ERROR);
         throw $exception;
     }
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:70,代码来源:mail.php

示例3: testQmailSend

 /**
  * Test sending using Qmail.
  */
 public function testQmailSend()
 {
     //Only run if we have qmail installed
     if (file_exists('/var/qmail/bin/qmail-inject')) {
         $this->Mail->Body = 'Sending via qmail';
         $this->BuildBody();
         $subject = $this->Mail->Subject;
         $this->Mail->Subject = $subject . ': qmail';
         $this->Mail->IsQmail();
         $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
     } else {
         $this->markTestSkipped('Qmail is not installed');
     }
 }
开发者ID:hanschrome,项目名称:JSONBackendFramework,代码行数:17,代码来源:phpmailerTest.php

示例4: switch

 /**
  * Constructor.
  */
 function __construct()
 {
     require_once PHPMAILER_CLASS;
     require_once PHPMAILER_SMTP;
     require_once PHPMAILER_POP3;
     // Inicializa la instancia PHPMailer.
     $mail = new \PHPMailer();
     // Define  el idioma para los mensajes de error.
     $mail->SetLanguage("es", PHPMAILER_LANGS);
     // Define la codificación de caracteres del mensaje.
     $mail->CharSet = "UTF-8";
     // Define el ajuste de texto a un número determinado de caracteres en el cuerpo del mensaje.
     $mail->WordWrap = 50;
     // Define el tipo de gestor de correo
     switch (GOTEO_MAIL_TYPE) {
         default:
         case "mail":
             $mail->isMail();
             // set mailer to use PHP mail() function.
             break;
         case "sendmail":
             $mail->IsSendmail();
             // set mailer to use $Sendmail program.
             break;
         case "qmail":
             $mail->IsQmail();
             // set mailer to use qmail MTA.
             break;
         case "smtp":
             $mail->IsSMTP();
             // set mailer to use SMTP
             $mail->SMTPAuth = GOTEO_MAIL_SMTP_AUTH;
             // enable SMTP authentication
             $mail->SMTPSecure = GOTEO_MAIL_SMTP_SECURE;
             // sets the prefix to the servier
             $mail->Host = GOTEO_MAIL_SMTP_HOST;
             // specify main and backup server
             $mail->Port = GOTEO_MAIL_SMTP_PORT;
             // set the SMTP port
             $mail->Username = GOTEO_MAIL_SMTP_USERNAME;
             // SMTP username
             $mail->Password = GOTEO_MAIL_SMTP_PASSWORD;
             // SMTP password
             break;
     }
     $this->mail = $mail;
 }
开发者ID:Umisinglcc,项目名称:Goteo,代码行数:50,代码来源:mail.php

示例5:

 /**
  * Miscellaneous calls to improve test coverage and some small tests
  */
 function test_Miscellaneous()
 {
     $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
     $this->Mail->AddCustomHeader('SomeHeader: Some Value');
     $this->Mail->ClearCustomHeaders();
     $this->Mail->ClearAttachments();
     $this->Mail->IsHTML(false);
     $this->Mail->IsSMTP();
     $this->Mail->IsMail();
     $this->Mail->IsSendMail();
     $this->Mail->IsQmail();
     $this->Mail->SetLanguage('fr');
     $this->Mail->Sender = '';
     $this->Mail->CreateHeader();
     $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
     $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
 }
开发者ID:NurulRizal,项目名称:BB,代码行数:20,代码来源:phpmailerTest.php

示例6: send_mail

function send_mail($mail_to, $mail_body, $mail_subject = 'No title', $mail_name = 'No name', $mail_from = '', $mail_priority = 3, $mail_wordwrap = 50, $mail_altbody = '')
{
    global $GO_CONFIG;
    //	$mail_to='ductk@hptvietnam.com.vn';
    //	$mail_from = 'bigduck1004@yahoo.com';
    //	$mail_name = "333";
    //	$mail_subject = 'subject';
    //	$mail_body = '123456789';
    //	$mail_altbody = 'qqqqqqqqqqqqqqqq';
    require $GO_CONFIG->class_path . "phpmailer/class.phpmailer.php";
    require $GO_CONFIG->class_path . "phpmailer/class.smtp.php";
    $mail = new PHPMailer();
    $mail->PluginDir = $GO_CONFIG->class_path . 'phpmailer/';
    $mail->SetLanguage($php_mailer_lang, $GO_CONFIG->class_path . 'phpmailer/language/');
    switch ($GO_CONFIG->mailer) {
        case 'smtp':
            $mail->Host = $GO_CONFIG->smtp_server;
            $mail->Port = $GO_CONFIG->smtp_port;
            $mail->IsSMTP();
            break;
        case 'qmail':
            $mail->IsQmail();
            break;
        case 'sendmail':
            $mail->IsSendmail();
            break;
        case 'mail':
            $mail->IsMail();
            break;
    }
    $mail->Priority = $mail_priority;
    $mail->Sender = $mail_from;
    $mail->From = $mail_from;
    $mail->FromName = $mail_name;
    $mail->AddReplyTo($mail_from, $mail_name);
    $mail->WordWrap = $mail_wordwrap;
    //    $mail->Encoding = "quoted-printable";
    $mail->IsHTML(true);
    $mail->Subject = $mail_subject;
    $mail->AddAddress($mail_to);
    $mail->Body = $mail_body;
    $mail->AltBody = $mail_altbody;
    if (!$mail->Send()) {
        return '<p class="Error">' . $ml_send_error . ' ' . $mail->ErrorInfo . '</p>';
    }
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:46,代码来源:tkdlib.php

示例7: dbem_send_mail

function dbem_send_mail($subject = "no title", $body = "No message specified", $receiver = '')
{
    global $smtpsettings, $phpmailer, $cformsSettings;
    if (file_exists(dirname(__FILE__) . '/class.phpmailer.php') && !class_exists('PHPMailer')) {
        require_once dirname(__FILE__) . '/class.phpmailer.php';
        require_once dirname(__FILE__) . '/class.smtp.php';
    }
    $mail = new PHPMailer();
    $mail->ClearAllRecipients();
    $mail->ClearAddresses();
    $mail->ClearAttachments();
    $mail->CharSet = 'utf-8';
    $mail->SetLanguage('en', dirname(__FILE__) . '/');
    $mail->PluginDir = dirname(__FILE__) . '/';
    get_option('dbem_rsvp_mail_send_method') == 'qmail' ? $mail->IsQmail() : ($mail->Mailer = get_option('dbem_rsvp_mail_send_method'));
    $mail->Host = get_option('dbem_smtp_host');
    $mail->port = get_option('dbem_rsvp_mail_port');
    if (get_option('dbem_rsvp_mail_SMTPAuth') == '1') {
        $mail->SMTPAuth = TRUE;
    }
    $mail->Username = get_option('dbem_smtp_username');
    $mail->Password = get_option('dbem_smtp_password');
    $mail->From = get_option('dbem_mail_sender_address');
    //$mail->SMTPDebug = true;
    $mail->FromName = get_option('dbem_mail_sender_name');
    // This is the from name in the email, you can put anything you like here
    $mail->Body = $body;
    $mail->Subject = $subject;
    $mail->AddAddress($receiver);
    if (!$mail->Send()) {
        echo "Message was not sent<br/ >";
        echo "Mailer Error: " . $mail->ErrorInfo;
        // print_r($mailer);
    } else {
        // echo "Message has been sent";
    }
}
开发者ID:elizabethcb,项目名称:Daily-Globe,代码行数:37,代码来源:dbem_phpmailer.php

示例8: eme_send_mail

function eme_send_mail($subject,$body, $receiveremail, $receivername='', $replytoemail='', $replytoname='') {

   // don't send empty mails
   if (empty($body) || empty($subject)) return;

   $eme_rsvp_mail_send_method = get_option('eme_rsvp_mail_send_method');
   if (get_option('eme_mail_sender_address') == "") {
      $fromMail = $replytoemail;
      $fromName = $replytoname;
   } else {
      $fromMail = get_option('eme_mail_sender_address');
      $fromName = get_option('eme_mail_sender_name'); // This is the from name in the email, you can put anything you like here
   }
   $eme_bcc_address= get_option('eme_mail_bcc_address');

   if ($eme_rsvp_mail_send_method == 'wp_mail') {
      // Set the correct mail headers
      $headers[] = "From: $fromName <$fromMail>";
      if ($replytoemail != "")
         $headers[] = "ReplyTo: $replytoname <$replytoemail>";
      if (!empty($eme_bcc_address))
         $headers[] = "Bcc: $eme_bcc_address";

      // set the correct content type
      if (get_option('eme_rsvp_send_html') == '1')
          add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));

      // now send it
      wp_mail( $receiveremail, $subject, $body, $headers );  

      // Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
      if (get_option('eme_rsvp_send_html') == '1')
         remove_filter('wp_mail_content_type', 'set_html_content_type' );

   } else {
      require_once(ABSPATH . WPINC . "/class-phpmailer.php");
      // there's a bug in class-phpmailer from wordpress, so we need to copy class-smtp.php
      // in this dir for smtp to work
      
      if (class_exists('PHPMailer')) {
         $mail = new PHPMailer();
         $mail->ClearAllRecipients();
         $mail->ClearAddresses();
         $mail->ClearAttachments();
         $mail->CharSet = 'utf-8';
         $mail->SetLanguage('en', dirname(__FILE__).'/');

         $mail->PluginDir = dirname(__FILE__).'/';
         if ($eme_rsvp_mail_send_method == 'qmail')
            $mail->IsQmail();
         else
            $mail->Mailer = $eme_rsvp_mail_send_method;

         if ($eme_rsvp_mail_send_method == 'smtp') {
            if (get_option('eme_smtp_host'))
               $mail->Host = get_option('eme_smtp_host');
            else
               $mail->Host = "localhost";

            if (strstr($mail->Host,'ssl://')) {
               $mail->SMTPSecure="ssl";
               $mail->Host = str_replace("ssl://","",$mail->Host);
            }
            if (strstr($mail->Host,'tls://')) {
               $mail->SMTPSecure="tls";
               $mail->Host = str_replace("tls://","",$mail->Host);
            }

            if (get_option('eme_smtp_port'))
               $mail->port = get_option('eme_smtp_port');
            else
               $mail->port = 25;

            if (get_option('eme_rsvp_mail_SMTPAuth') == '1') {
               $mail->SMTPAuth = true;
               $mail->Username = get_option('eme_smtp_username');
               $mail->Password = get_option('eme_smtp_password');
            }
            if (get_option('eme_smtp_debug'))
               $mail->SMTPDebug = 2;
         }
         $mail->From = $fromMail;
         $mail->FromName = $fromName;
         if (get_option('eme_rsvp_send_html') == '1')
            $mail->MsgHTML($body);
         else
            $mail->Body = $body;
         $mail->Subject = $subject;
         if (!empty($replytoemail))
            $mail->AddReplyTo($replytoemail,$replytoname);
         if (!empty($eme_bcc_address))
            $mail->AddBCC($eme_bcc_address);

         if (!empty($receiveremail)) {
            $mail->AddAddress($receiveremail,$receivername);
            if(!$mail->Send()){
               #echo "<br />Message was not sent<br/ >";
               #echo "Mailer Error: " . $mail->ErrorInfo;
               return false;
            } else {
//.........这里部分代码省略.........
开发者ID:johnmanlove,项目名称:Bridgeland,代码行数:101,代码来源:eme_phpmailer.php

示例9: email_user

/**
 * Always use this function for all emails to users
 *
 * @param object $userto user object to send email to. must contain firstname,lastname,preferredname,email
 * @param object $userfrom user object to send email from. If null, email will come from mahara
 * @param string $subject email subject
 * @param string $messagetext text version of email
 * @param string $messagehtml html version of email (will send both html and text)
 * @param array  $customheaders email headers
 * @throws EmailException
 * @throws EmailDisabledException
 */
function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml = '', $customheaders = null)
{
    global $IDPJUMPURL;
    static $mnetjumps = array();
    if (!get_config('sendemail')) {
        // You can entirely disable Mahara from sending any e-mail via the
        // 'sendemail' configuration variable
        return true;
    }
    if (empty($userto)) {
        throw new InvalidArgumentException("empty user given to email_user");
    }
    if (isset($userto->id) && empty($userto->ignoredisabled)) {
        $maildisabled = property_exists($userto, 'maildisabled') ? $userto->maildisabled : get_account_preference($userto->id, 'maildisabled') == 1;
        if ($maildisabled) {
            throw new EmailDisabledException("email for this user has been disabled");
        }
    }
    // If the user is a remote xmlrpc user, trawl through the email text for URLs
    // to our wwwroot and modify the url to direct the user's browser to login at
    // their home site before hitting the link on this site
    if (!empty($userto->mnethostwwwroot) && !empty($userto->mnethostapp)) {
        require_once get_config('docroot') . 'auth/xmlrpc/lib.php';
        // Form the request url to hit the idp's jump.php
        if (isset($mnetjumps[$userto->mnethostwwwroot])) {
            $IDPJUMPURL = $mnetjumps[$userto->mnethostwwwroot];
        } else {
            $mnetjumps[$userto->mnethostwwwroot] = $IDPJUMPURL = PluginAuthXmlrpc::get_jump_url_prefix($userto->mnethostwwwroot, $userto->mnethostapp);
        }
        $wwwroot = get_config('wwwroot');
        $messagetext = preg_replace_callback('%(' . $wwwroot . '([\\w_:\\?=#&@/;.~-]*))%', 'localurl_to_jumpurl', $messagetext);
        $messagehtml = preg_replace_callback('%href=["\'`](' . $wwwroot . '([\\w_:\\?=#&@/;.~-]*))["\'`]%', 'localurl_to_jumpurl', $messagehtml);
    }
    require_once 'phpmailer/PHPMailerAutoload.php';
    $mail = new PHPMailer(true);
    $mail->CharSet = 'UTF-8';
    $smtphosts = get_config('smtphosts');
    if ($smtphosts == 'qmail') {
        // use Qmail system
        $mail->IsQmail();
    } else {
        if (empty($smtphosts)) {
            // use PHP mail() = sendmail
            $mail->IsMail();
        } else {
            $mail->IsSMTP();
            // use SMTP directly
            $mail->Host = get_config('smtphosts');
            if (get_config('smtpuser')) {
                // Use SMTP authentication
                $mail->SMTPAuth = true;
                $mail->Username = get_config('smtpuser');
                $mail->Password = get_config('smtppass');
                $mail->SMTPSecure = get_config('smtpsecure');
                $mail->Port = get_config('smtpport');
                if (get_config('smtpsecure') && !get_config('smtpport')) {
                    // Encrypted connection with no port. Use default one.
                    if (get_config('smtpsecure') == 'ssl') {
                        $mail->Port = 465;
                    } elseif (get_config('smtpsecure') == 'tls') {
                        $mail->Port = 587;
                    }
                }
            }
        }
    }
    if (get_config('bounces_handle') && !empty($userto->id) && empty($maildisabled)) {
        $mail->Sender = generate_email_processing_address($userto->id, $userto);
    }
    if (empty($userfrom) || $userfrom->email == get_config('noreplyaddress')) {
        if (empty($mail->Sender)) {
            $mail->Sender = get_config('noreplyaddress');
        }
        $mail->From = get_config('noreplyaddress');
        $mail->FromName = isset($userfrom->id) ? display_name($userfrom, $userto) : get_config('sitename');
        $customheaders[] = 'Precedence: Bulk';
        // Try to avoid pesky out of office responses
        $messagetext .= "\n\n" . get_string('pleasedonotreplytothismessage') . "\n";
        if ($messagehtml) {
            $messagehtml .= "\n\n<p>" . get_string('pleasedonotreplytothismessage') . "</p>\n";
        }
    } else {
        if (empty($mail->Sender)) {
            $mail->Sender = $userfrom->email;
        }
        $mail->From = $userfrom->email;
        $mail->FromName = display_name($userfrom, $userto);
    }
//.........这里部分代码省略.........
开发者ID:patkira,项目名称:mahara,代码行数:101,代码来源:user.php

示例10: test_mail_direct

function test_mail_direct($tab_new_values, $session, $DEBUG = FALSE)
{
    $session = session_id();
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $destination = $tab_new_values['mail_to'];
    $destination_2 = $tab_new_values['mail_to_2'];
    /*******************************************************************/
    error_reporting(E_ALL);
    echo "<b>Direct Mail Test </b><br><br>\n";
    echo "<b>MAIL:</b><br>From = from@example.com<br>To = {$destination}, {$destination_2}<br><br>\n";
    // preparation du test de mail
    require LIBRARY_PATH . 'phpmailer/class.phpmailer.php';
    $mail = new PHPMailer();
    $mail->SetLanguage("fr", LIBRARY_PATH . "phpmailer/language/");
    $mail->From = "from@example.com";
    $mail->FromName = "PHP_CONGES";
    $mail->AddAddress($destination);
    if ($destination_2 != "") {
        $mail->AddAddress($destination_2);
    }
    //$mail->AddAddress("ellen@example.com");                  // name is optional
    //$mail->AddReplyTo("info@example.com", "Information");
    $mail->WordWrap = 50;
    // set word wrap to 50 characters
    //$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
    //$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
    //$mail->IsHTML(true);                                  // set email format to HTML
    $mail->Subject = "test phpmailer / php_conges";
    //$mail->Body    = "This is the HTML message body <b>in bold!</b>";
    //$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
    $mail->Body = "This is the body in plain text for non-HTML mail clients";
    // test envoie du mail
    echo "<b>Mail Test :</b><br>\n";
    echo "<b>send message using PHP mail() function :</b><br>\n";
    $mail->IsMail();
    // send message using PHP mail() function
    if (!$mail->Send()) {
        echo "Message could not be sent. <p>";
        echo "Mailer Error: " . $mail->ErrorInfo . "<br><br>";
    } else {
        echo "Message has been sent.<br><br>\n";
    }
    echo "<b>send message using the Sendmail program :</b><br>\n";
    if (!file_exists("/usr/sbin/sendmail")) {
        echo "/usr/sbin/sendmail doesn't exist.<br><br>\n";
    } else {
        $mail->IsSendmail();
        // send message using the $Sendmail program
        if (!$mail->Send()) {
            echo "Message could not be sent. <p>";
            echo "Mailer Error: " . $mail->ErrorInfo . "<br><br>";
        } else {
            echo "Message has been sent.<br><br>\n";
        }
    }
    echo "<b>send message using the qmail MTA :</b><br>\n";
    if (!file_exists("/var/qmail/bin/sendmail")) {
        echo "/var/qmail/bin/sendmail doesn't exist.<br><br>\n";
    } else {
        $mail->IsQmail();
        // send message using the qmail MTA
        if (!$mail->Send()) {
            echo "Message could not be sent. <p>";
            echo "Mailer Error: " . $mail->ErrorInfo . "<br><br>";
        } else {
            echo "Message has been sent.<br><br>\n";
        }
    }
    echo "<br><br><a href=\"{$PHP_SELF}?session={$session}\" method=\"POST\">" . _('form_retour') . "</a><br>\n";
}
开发者ID:kakargias,项目名称:php-conges,代码行数:70,代码来源:test_mail.php

示例11: getPhpMailer

 public function getPhpMailer()
 {
     require_once 'protected/components/phpMailer/class.phpmailer.php';
     $phpMail = new PHPMailer(true);
     // the true param means it will throw exceptions on errors, which we need to catch
     $phpMail->CharSet = 'utf-8';
     switch (Yii::app()->params->admin->emailType) {
         case 'sendmail':
             $phpMail->IsSendmail();
             break;
         case 'qmail':
             $phpMail->IsQmail();
             break;
         case 'smtp':
             $phpMail->IsSMTP();
             $phpMail->Host = Yii::app()->params->admin->emailHost;
             $phpMail->Port = Yii::app()->params->admin->emailPort;
             $phpMail->SMTPSecure = Yii::app()->params->admin->emailSecurity;
             if (Yii::app()->params->admin->emailUseAuth == 'admin') {
                 $phpMail->SMTPAuth = true;
                 $phpMail->Username = Yii::app()->params->admin->emailUser;
                 $phpMail->Password = Yii::app()->params->admin->emailPass;
             }
             break;
         case 'mail':
         default:
             $phpMail->IsMail();
     }
     return $phpMail;
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:30,代码来源:x2base.php

示例12: PHPMailer

// value adjustments
$smtp['auth'] = $smtp['auth'] == "true" ? true : false;
$smtp['password'] = $smtp['password'] != '' ? $smtp['password'] : null;
$smtp['secure'] = $smtp['secure'] != "none" ? $smtp['secure'] : null;
$smtp['username'] = $smtp['username'] != '' ? $smtp['username'] : null;
//send the email
include "resources/phpmailer/class.phpmailer.php";
include "resources/phpmailer/class.smtp.php";
$mail = new PHPMailer();
if (isset($_SESSION['email']['method'])) {
    switch ($_SESSION['email']['method']['text']) {
        case 'sendmail':
            $mail->IsSendmail();
            break;
        case 'qmail':
            $mail->IsQmail();
            break;
        case 'mail':
            $mail->IsMail();
            break;
        default:
            $mail->IsSMTP();
            break;
    }
} else {
    $mail->IsSMTP();
}
$mail->SMTPAuth = $smtp['auth'];
$mail->Host = $smtp['host'];
if ($smtp['port'] != 0) {
    $mail->Port = $smtp['port'];
开发者ID:kpabijanskas,项目名称:fusionpbx,代码行数:31,代码来源:v_mailto.php

示例13: constuct_and_send_mail

function constuct_and_send_mail($objet, $mail_sender_name, $mail_sender_addr, $mail_dest_name, $mail_dest_addr, $num_periode, $DEBUG = FALSE)
{
    /*********************************************/
    // init du mail
    $mail = new PHPMailer();
    if ($_SESSION['config']['serveur_smtp'] == '') {
        if (file_exists('/usr/sbin/sendmail')) {
            $mail->IsSendmail();
        } elseif (file_exists('/var/qmail/bin/sendmail')) {
            $mail->IsQmail();
        } else {
            $mail->IsMail();
        }
        // send message using PHP mail() function
    } else {
        $mail->IsSMTP();
        $mail->Host = $_SESSION['config']['serveur_smtp'];
    }
    // initialisation du langage utilisé par php_mailer
    $mail->SetLanguage('fr', LIBRARY_PATH . 'phpmailer/language/');
    $mail->FromName = $mail_sender_name;
    $mail->From = $mail_sender_addr;
    $mail->AddAddress($mail_dest_addr);
    /*********************************************/
    // recup des infos de l'absence
    $select_abs = 'SELECT conges_periode.p_date_deb,
                    conges_periode.p_demi_jour_deb,
                    conges_periode.p_date_fin,
                    conges_periode.p_demi_jour_fin,
                    conges_periode.p_nb_jours,
                    conges_periode.p_commentaire,
                    conges_type_absence.ta_libelle
                FROM   conges_periode, conges_type_absence
                WHERE  conges_periode.p_num=' . $num_periode . '
                        AND    conges_periode.p_type = conges_type_absence.ta_id;';
    $res_abs = SQL::query($select_abs);
    $rec_abs = $res_abs->fetch_array();
    $tab_date_deb = explode('-', $rec_abs['p_date_deb']);
    // affiche : "23 / 01 / 2008 (am)"
    $sql_date_deb = $tab_date_deb[2] . " / " . $tab_date_deb[1] . " / " . $tab_date_deb[0] . " (" . $rec_abs["p_demi_jour_deb"] . ")";
    $tab_date_fin = explode("-", $rec_abs["p_date_fin"]);
    // affiche : "23 / 01 / 2008 (am)"
    $sql_date_fin = $tab_date_fin[2] . " / " . $tab_date_fin[1] . " / " . $tab_date_fin[0] . " (" . $rec_abs["p_demi_jour_fin"] . ")";
    $sql_nb_jours = $rec_abs["p_nb_jours"];
    $sql_commentaire = $rec_abs["p_commentaire"];
    $sql_type_absence = $rec_abs["ta_libelle"];
    /*********************************************/
    // construction des sujets et corps des messages
    if ($objet == "valid_conges") {
        $key1 = "mail_prem_valid_conges_sujet";
        $key2 = "mail_prem_valid_conges_contenu";
    } elseif ($objet == "accept_conges") {
        $key1 = "mail_valid_conges_sujet";
        $key2 = "mail_valid_conges_contenu";
    } elseif ($objet == "new_demande_resp_absent") {
        $key1 = "mail_new_demande_resp_absent_sujet";
        $key2 = "mail_new_demande_resp_absent_contenu";
    } else {
        $key1 = "mail_" . $objet . "_sujet";
        $key2 = "mail_" . $objet . "_contenu";
    }
    $sujet = $_SESSION['config'][$key1];
    $contenu = $_SESSION['config'][$key2];
    $contenu = str_replace("__URL_ACCUEIL_CONGES__", $_SESSION['config']['URL_ACCUEIL_CONGES'], $contenu);
    $contenu = str_replace("__SENDER_NAME__", $mail_sender_name, $contenu);
    $contenu = str_replace("__DESTINATION_NAME__", $mail_dest_name, $contenu);
    $contenu = str_replace("__NB_OF_DAY__", $sql_nb_jours, $contenu);
    $contenu = str_replace("__DATE_DEBUT__", $sql_date_deb, $contenu);
    $contenu = str_replace("__DATE_FIN__", $sql_date_fin, $contenu);
    $contenu = str_replace("__RETOUR_LIGNE__", "\r\n", $contenu);
    $contenu = str_replace("__COMMENT__", $sql_commentaire, $contenu);
    $contenu = str_replace("__TYPE_ABSENCE__", $sql_type_absence, $contenu);
    // construction du corps du mail
    $mail->Subject = stripslashes(utf8_decode($sujet));
    $mail->Body = stripslashes(utf8_decode($contenu));
    /*********************************************/
    // ENVOI du mail
    if ($DEBUG) {
        echo "SUBJECT = " . $sujet . "<br>\n";
        echo "CONTENU = " . $mail->FromName . " " . $contenu . "<br>\n";
    } else {
        if (count($mail->to) == 0) {
            echo "<b>ERROR : No recipient address for the message!</b><br>\n";
            echo "<b>Message was not sent </b><br>";
        } else {
            if (!$mail->Send()) {
                echo "<b>Message was not sent </b><br>";
                echo "<b>Mailer Error: " . $mail->ErrorInfo . "</b><br>";
            }
        }
    }
}
开发者ID:kakargias,项目名称:php-conges,代码行数:92,代码来源:fonctions_conges.php

示例14: SendEmailMessage

/**
 * This function mails a text $body to the recipient $to.
 * You can use more than one recipient when using a semikolon separated string with recipients.
 * If you send several emails at once please supply an email object so that it can be re-used over and over. Especially with SMTP connections this speeds up things by 200%.
 * If you supply an email object Do not forget to close the mail connection by calling $mail->SMTPClose();
 *
 * @param mixed $mail This is an PHPMailer object. If null, one will be created automatically and unset afterwards. If supplied it won't be unset.
 * @param string $body Body text of the email in plain text or HTML
 * @param mixed $subject Email subject
 * @param mixed $to
 * @param mixed $from
 * @param mixed $sitename
 * @param mixed $ishtml
 * @param mixed $bouncemail
 * @param mixed $attachment
 * @return bool If successful returns true
 */
function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml = false, $bouncemail = null, $attachment = null, $customheaders = "")
{
    global $emailmethod, $emailsmtphost, $emailsmtpuser, $emailsmtppassword, $defaultlang, $emailsmtpdebug;
    global $rootdir, $maildebug, $maildebugbody, $emailsmtpssl, $clang, $demoModeOnly, $emailcharset;
    if (!is_array($customheaders) && $customheaders == '') {
        $customheaders = array();
    }
    if ($demoModeOnly == true) {
        $maildebug = $clang->gT('Email was not sent because demo-mode is activated.');
        $maildebugbody = '';
        return false;
    }
    if (is_null($bouncemail)) {
        $sender = $from;
    } else {
        $sender = $bouncemail;
    }
    $bUnsetEmail = false;
    if (is_null($mail)) {
        $bUnsetEmail = true;
        $mail = new PHPMailer();
    } else {
        $mail->SMTPKeepAlive = true;
    }
    if (!$mail->SetLanguage($defaultlang, $rootdir . '/classes/phpmailer/language/')) {
        $mail->SetLanguage('en', $rootdir . '/classes/phpmailer/language/');
    }
    $mail->CharSet = $emailcharset;
    if (isset($emailsmtpssl) && trim($emailsmtpssl) !== '' && $emailsmtpssl !== 0) {
        if ($emailsmtpssl === 1) {
            $mail->SMTPSecure = "ssl";
        } else {
            $mail->SMTPSecure = $emailsmtpssl;
        }
    }
    $fromname = '';
    $fromemail = $from;
    if (strpos($from, '<')) {
        $fromemail = substr($from, strpos($from, '<') + 1, strpos($from, '>') - 1 - strpos($from, '<'));
        $fromname = trim(substr($from, 0, strpos($from, '<') - 1));
    }
    $sendername = '';
    $senderemail = $sender;
    if (strpos($sender, '<')) {
        $senderemail = substr($sender, strpos($sender, '<') + 1, strpos($sender, '>') - 1 - strpos($sender, '<'));
        $sendername = trim(substr($sender, 0, strpos($sender, '<') - 1));
    }
    switch ($emailmethod) {
        case "qmail":
            $mail->IsQmail();
            break;
        case "smtp":
            $mail->IsSMTP();
            if ($emailsmtpdebug > 0) {
                $mail->SMTPDebug = true;
            }
            if (strpos($emailsmtphost, ':') > 0) {
                $mail->Host = substr($emailsmtphost, 0, strpos($emailsmtphost, ':'));
                $mail->Port = substr($emailsmtphost, strpos($emailsmtphost, ':') + 1);
            } else {
                $mail->Host = $emailsmtphost;
            }
            $mail->Username = $emailsmtpuser;
            $mail->Password = $emailsmtppassword;
            if (trim($emailsmtpuser) != "") {
                $mail->SMTPAuth = true;
            }
            break;
        case "sendmail":
            $mail->IsSendmail();
            break;
        default:
            //Set to the default value to rule out incorrect settings.
            $emailmethod = "mail";
            $mail->IsMail();
    }
    $mail->SetFrom($fromemail, $fromname);
    $mail->Sender = $senderemail;
    // Sets Return-Path for error notifications
    $toemails = explode(";", $to);
    foreach ($toemails as $singletoemail) {
        if (strpos($singletoemail, '<')) {
            $toemail = substr($singletoemail, strpos($singletoemail, '<') + 1, strpos($singletoemail, '>') - 1 - strpos($singletoemail, '<'));
//.........这里部分代码省略.........
开发者ID:karime7gezly,项目名称:OpenConextApps-LimeSurvey,代码行数:101,代码来源:common_functions.php

示例15: jsend_mail


//.........这里部分代码省略.........
                $mail->IsSMTP();
                $mail->Host = trim($block['smtp_addr']);
                if ($block['smtp_port'] != '25' && $block['smtp_port'] != '') {
                    $mail->Port = trim($block['smtp_port']);
                }
                $mail->LE = "\r\n";
                break;
            case 'smtpauth':
                $mail->IsSMTP();
                $mail->SMTPAuth = true;
                $mail->Username = zen_not_null($block['smtp_user']) ? trim($block['smtp_user']) : EMAIL_FROM;
                $mail->Password = trim($block['smtp_pwd']);
                $mail->Host = trim($block['smtp_addr']);
                if ($block['smtp_port'] != '25' && $block['smtp_port'] != '') {
                    $mail->Port = trim($block['smtp_port']);
                }
                $mail->LE = "\r\n";
                // set encryption protocol to allow support for Gmail or other secured email protocols
                if ($block['smtp_port'] == '465' || $block['smtp_port'] == '587' || $block['smtp_addr'] == 'smtp.gmail.com') {
                    $mail->Protocol = 'ssl';
                }
                if (defined('SMTPAUTH_EMAIL_PROTOCOL') && SMTPAUTH_EMAIL_PROTOCOL != 'none') {
                    $mail->Protocol = SMTPAUTH_EMAIL_PROTOCOL;
                    if (SMTPAUTH_EMAIL_PROTOCOL == 'starttls' && defined('SMTPAUTH_EMAIL_CERTIFICATE_CONTEXT')) {
                        $mail->Starttls = true;
                        $mail->Context = SMTPAUTH_EMAIL_CERTIFICATE_CONTEXT;
                    }
                }
                break;
            case 'PHP':
                $mail->IsMail();
                break;
            case 'Qmail':
                $mail->IsQmail();
                break;
            case 'sendmail':
            case 'sendmail-f':
                $mail->LE = "\n";
            default:
                $mail->IsSendmail();
                if (defined('EMAIL_SENDMAIL_PATH')) {
                    $mail->Sendmail = trim(EMAIL_SENDMAIL_PATH);
                }
                break;
        }
        $mail->Subject = $email_subject;
        $mail->From = $from_email_address;
        $mail->FromName = $from_email_name;
        $mail->AddAddress($to_email_address, $to_name);
        // $mail->AddAddress($to_email_address); // (alternate format if no name, since name is optional)
        // $mail->AddBCC(STORE_OWNER_EMAIL_ADDRESS, STORE_NAME);
        // set the reply-to address. If none set yet, then use Store's default email name/address.
        // If sending from contact-us or tell-a-friend page, use the supplied info
        $email_reply_to_address = isset($email_reply_to_address) && $email_reply_to_address != '' ? $email_reply_to_address : (in_array($module, array('contact_us', 'tell_a_friend')) ? $from_email_address : EMAIL_FROM);
        $email_reply_to_name = isset($email_reply_to_name) && $email_reply_to_name != '' ? $email_reply_to_name : (in_array($module, array('contact_us', 'tell_a_friend')) ? $from_email_name : STORE_NAME);
        $mail->AddReplyTo($email_reply_to_address, $email_reply_to_name);
        // if mailserver requires that all outgoing mail must go "from" an email address matching domain on server, set it to store address
        if (EMAIL_SEND_MUST_BE_STORE == 'Yes') {
            $mail->From = EMAIL_FROM;
        }
        if (EMAIL_TRANSPORT == 'sendmail-f' || EMAIL_SEND_MUST_BE_STORE == 'Yes') {
            $mail->Sender = EMAIL_FROM;
        }
        if (EMAIL_USE_HTML == 'true') {
            $email_html = processEmbeddedImages($email_html, $mail);
        }
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:67,代码来源:functions_email.php


注:本文中的PHPMailer::IsQmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。