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


PHP phpmailer::IsMail方法代码示例

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


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

示例1: send

 /**
  * Send mail, similar to PHP's mail
  *
  * A true return value does not automatically mean that the user received the
  * email successfully. It just only means that the method used was able to
  * process the request without any errors.
  *
  * The default content type is 'text/plain' which does not allow using HTML.
  */
 public static function send($from_email, $from_name, array $to, $subject, $message, array $cc = array(), array $bcc = array(), array $attachments = array())
 {
     $mailer = new phpmailer();
     $content_type = 'text/plain';
     $mailer->ContentType = $content_type;
     $mailer->Hostname = \lib\conf\constants::$domain;
     $mailer->IsMail();
     $mailer->IsHTML(false);
     $mailer->From = $from_email;
     $mailer->FromName = $from_name;
     // add recipients
     foreach ((array) $to as $recipient_name => $recipient_email) {
         $mailer->AddAddress(trim($recipient_email), trim($recipient_name));
     }
     // Add any CC and BCC recipients
     foreach ($cc as $recipient_name => $recipient_email) {
         $mailer->AddCc(trim($recipient_email), trim($recipient_name));
     }
     foreach ($bcc as $recipient_name => $recipient_email) {
         $mailer->AddBcc(trim($recipient_email), trim($recipient_name));
     }
     // Set mail's subject and body
     $mailer->Subject = $subject;
     $mailer->Body = $message;
     foreach ($attachments as $attachment) {
         $mailer->AddAttachment($attachment);
     }
     // Send!
     $result = $mailer->Send();
     return $result;
 }
开发者ID:revcozmo,项目名称:dating,代码行数:40,代码来源:mail.php

示例2: email_to_user

/**
 * Send an email to a specified user
 *
 * @uses $CFG
 * @param user $user  A {@link $USER} object
 * @param user $from A {@link $USER} object
 * @param string $subject plain text subject line of the email
 * @param string $messagetext plain text version of the message
 * @param string $messagehtml complete html version of the message (optional)
 * @param string $attachment a file on the filesystem
 * @param string $attachname the name of the file (extension indicates MIME)
 * @param bool $usetrueaddress determines whether $from email address should
 *          be sent out. Will be overruled by user profile setting for maildisplay
 * @return bool|string Returns "true" if mail was sent OK, "emailstop" if email
 *          was blocked by user and "false" if there was another sort of error.
 */
function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '', $attachment = '', $attachname = '', $usetrueaddress = true, $replyto = '', $replytoname = '')
{
    global $CFG;
    $textlib = textlib_get_instance();
    include_once $CFG->libdir . '/phpmailer/class.phpmailer.php';
    if (empty($user) || empty($user->email)) {
        return false;
    }
    /*
    if (over_bounce_threshold($user)) {
        error_log("User $user->id (".fullname($user).") is over bounce threshold! Not sending.");
        return false;
    }
    */
    // this doesn't exist right now, we may bring it in later though.
    $mail = new phpmailer();
    $mail->Version = 'Elgg ';
    // mailer version (should have $CFG->version on here but we don't have it yet)
    $mail->PluginDir = $CFG->libdir . '/phpmailer/';
    // plugin directory (eg smtp plugin)
    $mail->CharSet = 'UTF-8';
    // everything is now uft8
    if (empty($CFG->smtphosts)) {
        $mail->IsMail();
        // use PHP mail() = sendmail
    } else {
        if ($CFG->smtphosts == 'qmail') {
            $mail->IsQmail();
            // use Qmail system
        } else {
            $mail->IsSMTP();
            // use SMTP directly
            if ($CFG->debug > 7) {
                echo '<pre>' . "\n";
                $mail->SMTPDebug = true;
            }
            $mail->Host = $CFG->smtphosts;
            // specify main and backup servers
            if ($CFG->smtpuser) {
                // Use SMTP authentication
                $mail->SMTPAuth = true;
                $mail->Username = $CFG->smtpuser;
                $mail->Password = $CFG->smtppass;
            }
        }
    }
    /* not here yet, leave it in just in case.
       // make up an email address for handling bounces
       if (!empty($CFG->handlebounces)) {
           $modargs = 'B'.base64_encode(pack('V',$user->ident)).substr(md5($user->email),0,16);
           $mail->Sender = generate_email_processing_address(0,$modargs);
       }
       else {
           $mail->Sender   =  $CFG->sysadminemail;
       }
       */
    $mail->Sender = $CFG->sysadminemail;
    // for elgg. delete if we change the above.
    // TODO add a preference for maildisplay
    if (is_string($from)) {
        // So we can pass whatever we want if there is need
        $mail->From = $CFG->noreplyaddress;
        $mail->FromName = $from;
    } else {
        if (empty($from)) {
            // make stuff up
            $mail->From = $CFG->sysadminemail;
            $mail->FromName = $CFG->sitename . ' ' . __gettext('Administrator');
        } else {
            if ($usetrueaddress and !empty($from->maildisplay)) {
                $mail->From = $from->email;
                $mail->FromName = $from->name;
            } else {
                $mail->From = $CFG->noreplyaddress;
                $mail->FromName = $from->name;
                if (empty($replyto)) {
                    $mail->AddReplyTo($CFG->noreplyaddress, __gettext('Do not reply'));
                }
            }
        }
    }
    if (!empty($replyto)) {
        $mail->AddReplyTo($replyto, $replytoname);
    }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:101,代码来源:elgglib.php

示例3: sendList

 function sendList($list)
 {
     // send email of message
     global $loader, $intl, $conf;
     $loader->import('saf.Ext.phpmailer');
     $mail = new phpmailer();
     $mail->IsMail();
     $mail->IsHTML(true);
     foreach ($list as $item) {
         if (strtoupper($item->type) == 'TASK') {
             $id = 'T' . $item->id;
         } elseif (strtoupper($item->type) == 'MESSAGE') {
             $id = 'M' . $item->id;
         } else {
             $id = strtoupper(substr($item->type, 0, 1)) . $item->id;
         }
         $mail->From = $conf['Messaging']['return_address'];
         //$mail->Subject = '[' . $this->id . '] ' . $this->subject;
         //$mail->Body = $this->body;
         $mail->AddAddress($item->address);
         if (defined('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_SUBJECT')) {
             $mail->Subject = $intl->get(constant('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_SUBJECT'), $item->struct);
         } else {
             $mail->Subject = '[' . $id . '] ' . $item->subject;
         }
         if (defined('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_BODY')) {
             $mail->Body = $intl->get(constant('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_BODY'), $item->struct);
         } else {
             $mail->Body = $item->body;
         }
         if ($item->priority == 'urgent' || $item->priority == 'high') {
             $mail->Priority = 1;
         } else {
             $mail->Priority = 3;
         }
         if (!$mail->Send()) {
             $this->error = $mail->ErrorInfo;
             return false;
         }
         $mail->ClearAddresses();
         $mail->ClearAttachments();
     }
     return true;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:44,代码来源:Email.php

示例4: send

 function send()
 {
     // send email of message
     global $loader, $intl, $conf;
     $loader->import('saf.Ext.phpmailer');
     $mail = new phpmailer();
     $mail->IsMail();
     if (strtoupper($this->type) == 'TASK') {
         $this->id = 'T' . $this->id;
     } elseif (strtoupper($this->type) == 'MESSAGE') {
         $this->id = 'M' . $this->id;
     } else {
         $this->id = strtoupper(substr($this->type, 0, 1)) . $this->id;
     }
     $mail->From = $conf['Messaging']['return_address'];
     if (defined('WORKSPACE_' . strtoupper($this->type) . '_' . strtoupper($this->name) . '_SUBJECT')) {
         $mail->Subject = $intl->get(constant('WORKSPACE_' . strtoupper($this->type) . '_' . strtoupper($this->name) . '_SUBJECT'), $this);
     } else {
         $mail->Subject = '[' . $this->id . '] ' . $intl->get('Notice');
     }
     if (defined('WORKSPACE_' . strtoupper($this->type) . '_' . strtoupper($this->name) . '_BODY')) {
         $mail->Body = $intl->get(constant('WORKSPACE_' . strtoupper($this->type) . '_' . strtoupper($this->name) . '_BODY'), $this);
     } else {
         $mail->Body = $this->subject;
     }
     // message body should be less than $this->charlimit characters
     $mail->Body = substr($mail->Body, 0, $this->charlimit);
     $mail->AddAddress($this->address);
     if ($this->priority == 'urgent' || $this->priority == 'high') {
         $mail->Priority = 1;
     }
     if ($mail->Send()) {
         return true;
     }
     $this->error = $mail->ErrorInfo;
     return false;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:37,代码来源:SMS.php

示例5: 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 (!($mailinfo = can_receive_email($userto))) {
        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/class.phpmailer.php';
    $mail = new phpmailer();
    // Leaving this commented out - there's no reason for people to know this
    //$mail->Version = 'Mahara ' . get_config('release');
    $mail->PluginDir = get_config('libroot') . 'phpmailer/';
    $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');
            }
        }
    }
    if (get_config('bounces_handle') && isset($mailinfo->owner)) {
        $mail->Sender = generate_email_processing_address($mailinfo->owner, $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);
    }
    $replytoset = false;
    if (!empty($customheaders) && is_array($customheaders)) {
        foreach ($customheaders as $customheader) {
            $mail->AddCustomHeader($customheader);
            if (0 === stripos($customheader, 'reply-to')) {
                $replytoset = true;
            }
        }
    }
    if (!$replytoset) {
//.........这里部分代码省略.........
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:101,代码来源:user.php

示例6: phpmailer

/**
 * Get mailer instance, enable buffering, flush buffer or disable buffering.
 * @param $action string 'get', 'buffer', 'close' or 'flush'
 * @return reference to mailer instance if 'get' used or nothing
 */
function &get_mailer($action = 'get')
{
    global $CFG;
    static $mailer = null;
    static $counter = 0;
    if (!isset($CFG->smtpmaxbulk)) {
        $CFG->smtpmaxbulk = 1;
    }
    if ($action == 'get') {
        $prevkeepalive = false;
        if (isset($mailer) and $mailer->Mailer == 'smtp') {
            if ($counter < $CFG->smtpmaxbulk and empty($mailer->error_count)) {
                $counter++;
                // reset the mailer
                $mailer->Priority = 3;
                $mailer->CharSet = 'UTF-8';
                // our default
                $mailer->ContentType = "text/plain";
                $mailer->Encoding = "8bit";
                $mailer->From = "root@localhost";
                $mailer->FromName = "Root User";
                $mailer->Sender = "";
                $mailer->Subject = "";
                $mailer->Body = "";
                $mailer->AltBody = "";
                $mailer->ConfirmReadingTo = "";
                $mailer->ClearAllRecipients();
                $mailer->ClearReplyTos();
                $mailer->ClearAttachments();
                $mailer->ClearCustomHeaders();
                return $mailer;
            }
            $prevkeepalive = $mailer->SMTPKeepAlive;
            get_mailer('flush');
        }
        include_once $CFG->libdir . '/phpmailer/class.phpmailer.php';
        $mailer = new phpmailer();
        $counter = 1;
        $mailer->Version = 'Moodle ' . $CFG->version;
        // mailer version
        $mailer->PluginDir = $CFG->libdir . '/phpmailer/';
        // plugin directory (eg smtp plugin)
        $mailer->CharSet = 'UTF-8';
        // some MTAs may do double conversion of LF if CRLF used, CRLF is required line ending in RFC 822bis
        // hmm, this is a bit hacky because LE should be private
        if (isset($CFG->mailnewline) and $CFG->mailnewline == 'CRLF') {
            $mailer->LE = "\r\n";
        } else {
            $mailer->LE = "\n";
        }
        if ($CFG->smtphosts == 'qmail') {
            $mailer->IsQmail();
            // use Qmail system
        } else {
            if (empty($CFG->smtphosts)) {
                $mailer->IsMail();
                // use PHP mail() = sendmail
            } else {
                $mailer->IsSMTP();
                // use SMTP directly
                if (!empty($CFG->debugsmtp)) {
                    $mailer->SMTPDebug = true;
                }
                $mailer->Host = $CFG->smtphosts;
                // specify main and backup servers
                $mailer->SMTPKeepAlive = $prevkeepalive;
                // use previous keepalive
                if ($CFG->smtpuser) {
                    // Use SMTP authentication
                    $mailer->SMTPAuth = true;
                    $mailer->Username = $CFG->smtpuser;
                    $mailer->Password = $CFG->smtppass;
                }
            }
        }
        return $mailer;
    }
    $nothing = null;
    // keep smtp session open after sending
    if ($action == 'buffer') {
        if (!empty($CFG->smtpmaxbulk)) {
            get_mailer('flush');
            $m =& get_mailer();
            if ($m->Mailer == 'smtp') {
                $m->SMTPKeepAlive = true;
            }
        }
        return $nothing;
    }
    // close smtp session, but continue buffering
    if ($action == 'flush') {
        if (isset($mailer) and $mailer->Mailer == 'smtp') {
            if (!empty($mailer->SMTPDebug)) {
                echo '<pre>' . "\n";
            }
//.........这里部分代码省略.........
开发者ID:nadavkav,项目名称:rtlMoodle,代码行数:101,代码来源:moodlelib.php

示例7: send_email

function send_email($to, $subject, $body, $from = '', $fromname = '', $stmp = true, $sender = '', $host = '', $port = '', $ssl = '', $username = '', $password = '')
{
    global $charset;
    $mail = new phpmailer();
    if (!$stmp) {
        $mail->IsMail();
    } else {
        $mail->IsSMTP();
        $mail->SMTPAuth = true;
        $mail->Host = $host;
        if ($ssl) {
            $mail->SMTPSecure = "ssl";
        }
        if ($port != '') {
            $mail->Port = $port;
        }
        $mail->Username = $username;
        $mail->Password = $password;
    }
    $mail->IsHTML(true);
    $mail->Sender = $sender;
    $mail->FromEmail = $from;
    $mail->FromName = $fromname;
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->CharSet = $charset;
    $mail->WordWrap = 50;
    if (is_array($to)) {
        foreach ($to as $email) {
            $mail->AddAddress($email, "");
        }
    } else {
        $mail->AddAddress($to, "");
    }
    if ($fromname != '') {
        $mail->AddReplyTo($from, $fromname);
    }
    $mail->IsHTML(true);
    if (!$mail->Send()) {
        return "Mailer Error: " . $mail->ErrorInfo;
    } else {
        return true;
    }
}
开发者ID:saintho,项目名称:phpdisk,代码行数:44,代码来源:global.func.php

示例8: sloodle_text_email

/**
* Send an email to a specific address, using the Moodle system.
* This function is heavily based on "email_to_user()" from Moodle's libraries.
*
* @uses $CFG
* @uses $FULLME
* @param string $to The address to send the email to
* @param string $subject Plain text subject line of the email
* @param string $messagetext Plain text of the message
* @return bool Returns true if mail was sent OK, or false otherwise
*/
function sloodle_text_email($to, $subject, $messagetext)
{
    global $CFG, $FULLME;
    // Fetch the PHP mailing functionality
    include_once $CFG->libdir . '/phpmailer/class.phpmailer.php';
    // We are going to use textlib services here
    $textlib = textlib_get_instance();
    // Construct a new PHP mailer
    $mail = new phpmailer();
    $mail->Version = 'Moodle ' . $CFG->version;
    // mailer version
    $mail->PluginDir = $CFG->libdir . '/phpmailer/';
    // plugin directory (eg smtp plugin)
    // We will use Unicode UTF8
    $mail->CharSet = 'UTF-8';
    // Determine which mail system to use
    if ($CFG->smtphosts == 'qmail') {
        $mail->IsQmail();
        // use Qmail system
    } else {
        if (empty($CFG->smtphosts)) {
            $mail->IsMail();
            // use PHP mail() = sendmail
        } else {
            $mail->IsSMTP();
            // use SMTP directly
            if (!empty($CFG->debugsmtp)) {
                echo '<pre>' . "\n";
                $mail->SMTPDebug = true;
            }
            $mail->Host = $CFG->smtphosts;
            // specify main and backup servers
            if ($CFG->smtpuser) {
                // Use SMTP authentication
                $mail->SMTPAuth = true;
                $mail->Username = $CFG->smtpuser;
                $mail->Password = $CFG->smtppass;
            }
        }
    }
    // Use the admin's address for the Sender field
    $adminuser = get_admin();
    $mail->Sender = $adminuser->email;
    // Use the 'noreply' address
    $mail->From = $CFG->noreplyaddress;
    $mail->FromName = $CFG->wwwroot;
    // Setup the other headers
    $mail->Subject = substr(stripslashes($subject), 0, 900);
    $mail->AddAddress(stripslashes($to), 'Sloodle');
    //$mail->WordWrap = 79; // We don't want to do a wordwrap
    // Add our message text
    $mail->IsHTML(false);
    $mail->Body = $messagetext;
    // Attempt to send the email
    if ($mail->Send()) {
        $mail->IsSMTP();
        // use SMTP directly
        if (!empty($CFG->debugsmtp)) {
            echo '</pre>';
        }
        return true;
    } else {
        mtrace('ERROR: ' . $mail->ErrorInfo);
        add_to_log(SITEID, 'library', 'mailer', $FULLME, 'ERROR: ' . $mail->ErrorInfo);
        if (!empty($CFG->debugsmtp)) {
            echo '</pre>';
        }
        return false;
    }
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:81,代码来源:mail.php

示例9: email_to_user

/**
 * Send an email to a specified user
 *
 * @uses $CFG
 * @uses $FULLME
 * @uses SITEID
 * @param user $user  A {@link $USER} object
 * @param user $from A {@link $USER} object
 * @param string $subject plain text subject line of the email
 * @param string $messagetext plain text version of the message
 * @param string $messagehtml complete html version of the message (optional)
 * @param string $attachment a file on the filesystem, relative to $CFG->dataroot
 * @param string $attachname the name of the file (extension indicates MIME)
 * @param bool $usetrueaddress determines whether $from email address should
 *          be sent out. Will be overruled by user profile setting for maildisplay
 * @return bool|string Returns "true" if mail was sent OK, "emailstop" if email
 *          was blocked by user and "false" if there was another sort of error.
 */
function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '', $attachment = '', $attachname = '', $usetrueaddress = true, $replyto = '', $replytoname = '')
{
    global $CFG, $FULLME;
    include_once $CFG->libdir . '/phpmailer/class.phpmailer.php';
    /// We are going to use textlib services here
    $textlib = textlib_get_instance();
    if (empty($user)) {
        return false;
    }
    // skip mail to suspended users
    if (isset($user->auth) && $user->auth == 'nologin') {
        return true;
    }
    if (!empty($user->emailstop)) {
        return 'emailstop';
    }
    if (over_bounce_threshold($user)) {
        error_log("User {$user->id} (" . fullname($user) . ") is over bounce threshold! Not sending.");
        return false;
    }
    $mail = new phpmailer();
    $mail->Version = 'Moodle ' . $CFG->version;
    // mailer version
    $mail->PluginDir = $CFG->libdir . '/phpmailer/';
    // plugin directory (eg smtp plugin)
    $mail->CharSet = 'UTF-8';
    if ($CFG->smtphosts == 'qmail') {
        $mail->IsQmail();
        // use Qmail system
    } else {
        if (empty($CFG->smtphosts)) {
            $mail->IsMail();
            // use PHP mail() = sendmail
        } else {
            $mail->IsSMTP();
            // use SMTP directly
            if (!empty($CFG->debugsmtp)) {
                echo '<pre>' . "\n";
                $mail->SMTPDebug = true;
            }
            $mail->Host = $CFG->smtphosts;
            // specify main and backup servers
            if ($CFG->smtpuser) {
                // Use SMTP authentication
                $mail->SMTPAuth = true;
                $mail->Username = $CFG->smtpuser;
                $mail->Password = $CFG->smtppass;
            }
        }
    }
    $supportuser = generate_email_supportuser();
    // make up an email address for handling bounces
    if (!empty($CFG->handlebounces)) {
        $modargs = 'B' . base64_encode(pack('V', $user->id)) . substr(md5($user->email), 0, 16);
        $mail->Sender = generate_email_processing_address(0, $modargs);
    } else {
        $mail->Sender = $supportuser->email;
    }
    if (is_string($from)) {
        // So we can pass whatever we want if there is need
        $mail->From = $CFG->noreplyaddress;
        $mail->FromName = $from;
    } else {
        if ($usetrueaddress and $from->maildisplay) {
            $mail->From = $from->email;
            $mail->FromName = fullname($from);
        } else {
            $mail->From = $CFG->noreplyaddress;
            $mail->FromName = fullname($from);
            if (empty($replyto)) {
                $mail->AddReplyTo($CFG->noreplyaddress, get_string('noreplyname'));
            }
        }
    }
    if (!empty($replyto)) {
        $mail->AddReplyTo($replyto, $replytoname);
    }
    $mail->Subject = substr(stripslashes($subject), 0, 900);
    $mail->AddAddress($user->email, fullname($user));
    $mail->WordWrap = 79;
    // set word wrap
    if (!empty($from->customheaders)) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:moodlelib.php

示例10: FirstSendMail

function FirstSendMail($r, $title, $msgtext)
{
    global $ecms_config;
    $mailer = new phpmailer();
    if ($r['sendmailtype'] == 1) {
        $mailer->IsSMTP();
        $mailer->Host = $r['smtphost'];
        //端口
        if ($r['smtpport']) {
            $mailer->Port = $r['smtpport'];
        }
        //SMTP服务器需要认证
        if ($r['loginemail']) {
            $mailer->SMTPAuth = true;
            $mailer->Username = $r['emailusername'];
            $mailer->Password = $r['emailpassword'];
        }
    } else {
        $mailer->IsMail();
    }
    $mailer->From = $r['fromemail'];
    $mailer->FromName = $r['emailname'];
    $mailer->IsHTML(true);
    $mailer->Subject = stripSlashes($title);
    //标题
    $mailer->Body = stripSlashes(nl2br(RepFieldtextNbsp($msgtext)));
    //内容
    //$mailer->CharSet("gbk");
    $mailer->CharSet = $ecms_config['sets']['pagechar'] ? $ecms_config['sets']['pagechar'] : 'gbk';
    return $mailer;
}
开发者ID:novnan,项目名称:meiju,代码行数:31,代码来源:SendEmail.inc.php

示例11: phpmailer

<?php

require "class.phpmailer.php";
$mail = new phpmailer();
$mail->IsMail();
/*$mail->IsSMTP();     
$mail->Mailer   = "smtp";  
$mail->Host     = "82.67.45.121"; // SMTP-Server
$mail->Port     = 25;*/
//$mail->SMTPAuth = true;     // SMTP mit Authentifizierung benutzen
// $mail->SMTPDebug = true;
//$mail->SMTPAuth = true;
//$mail->Username = "jedi";  // SMTP-Benutzername
//$mail->Password = "jedimail"; // SMTP-Passwort
$mail->LE = "\n";
$mail->From = "webmaster@delphi-jedi.org";
$mail->FromName = "Max Mustermann";
$mail->AddAddress("obones@free.fr", "fdsfds");
$mail->WordWrap = 50;
// Zeilenumbruch einstellen
// $mail->AddAttachment("/var/tmp/file.tar.gz");      // Attachment
// $mail->AddAttachment("/tmp/image.jpg", "new.jpg");
$mail->IsHTML(true);
// als HTML-E-Mail senden
$mail->Subject = "Test of PHPMailer";
$mail->Body = "Test with <b>PHPMailer</b>";
$mail->AltBody = "Hello, this is a test";
if (!$mail->Send()) {
    echo "Unable to send email <p>";
    echo "Mailer Error: " . $mail->ErrorInfo;
    exit;
开发者ID:amjadtbssm,项目名称:website,代码行数:31,代码来源:testphpmail.php

示例12: sendEmail

function sendEmail($send_method, $to, $from, $from_name, $subject, $body, $auth = 0, $smtp_host = '', $smtp_login = '', $smtp_pass = '', $charset = 'UTF-8')
{
    $mail = new phpmailer();
    $mail->CharSet = $charset;
    $mail->PluginDir = "include/lib/";
    switch ($send_method) {
        case "smtp":
            $mail->IsSMTP();
            $mail->Host = $smtp_host;
            if ($auth) {
                $mail->SMTPAuth = true;
                $mail->Username = $smtp_login;
                $mail->Password = $smtp_pass;
            }
            break;
        case "smtp_gmail":
            $mail->IsSMTP();
            $mail->SMTPAuth = true;
            $mail->SMTPSecure = 'tls';
            $mail->Host = "smtp.gmail.com";
            $mail->Port = 587;
            $mail->Username = $smtp_login;
            $mail->Password = $smtp_pass;
            break;
        case "php_mail":
            $mail->IsMail();
            break;
        default:
            break;
    }
    $mail->IsHTML(true);
    $mail->From = $from;
    $mail->FromName = $from_name;
    $mail->AddAddress($to);
    $mail->Subject = $subject;
    $mail->Body = $body;
    if (!$mail->Send()) {
        echo $mail->ErrorInfo;
        return -2;
    }
    return true;
}
开发者ID:Arnaud69,项目名称:phpmynewsletter-2.0,代码行数:42,代码来源:pmn_fonctions.php

示例13: FirstSendMail

function FirstSendMail($r, $title, $msgtext)
{
    global $phome_ecms_charver;
    $mailer = new phpmailer();
    if ($r['sendmailtype'] == 1) {
        $mailer->IsSMTP();
        $mailer->Host = $r['smtphost'];
        //¶Ë¿Ú
        if ($r['smtpport']) {
            $mailer->Port = $r['smtpport'];
        }
        //SMTP·þÎñÆ÷ÐèÒªÈÏÖ¤
        if ($r['loginemail']) {
            $mailer->SMTPAuth = true;
            $mailer->Username = $r['emailusername'];
            $mailer->Password = $r['emailpassword'];
        }
    } else {
        $mailer->IsMail();
    }
    $mailer->From = $r['fromemail'];
    $mailer->FromName = $r['emailname'];
    $mailer->IsHTML(true);
    $mailer->Subject = stripSlashes($title);
    //±êÌâ
    $mailer->Body = stripSlashes(nl2br(RepFieldtextNbsp($msgtext)));
    //ÄÚÈÝ
    //$mailer->CharSet("gbk");
    $mailer->CharSet = $phome_ecms_charver ? $phome_ecms_charver : 'gbk';
    return $mailer;
}
开发者ID:BGCX261,项目名称:zjh-dev-svn-to-git,代码行数:31,代码来源:SendEmail.inc.php

示例14: phpmailer

 /**
  * ubah ke global, masih pakai punya CLEAR
  */
 function send_email($to, $subject, $body)
 {
     include_once '/data/devel/applications/admin_men/libraries/phpmailer.php';
     $mail = new phpmailer();
     $mail->IsMail();
     $mail->IsHTML(true);
     $mail->Host = 'localhost';
     $mail->Port = 25;
     $mail->From = 'nobody@kapanlagi.net';
     $mail->FromName = 'KapanLagi.com';
     $mail->AddAddress($to);
     $mail->Subject = $subject;
     $mail->Body = $body;
     $mail->AltBody = preg_replace("/<br\\s?\\/*>/si", "\n", $body);
     $mail->Send();
 }
开发者ID:cyberorca,项目名称:dfp-api,代码行数:19,代码来源:core.php

示例15: supportSendMail

function supportSendMail($email, $name, $subject, $message, $response_flag = false)
{
    global $sendmethod, $sockethost, $smtpauth, $smtpauthuser, $smtpauthpass, $socketfrom, $socketfromname, $socketreply, $socketreplyname;
    include_once 'class.phpmailer.php';
    $mail = new phpmailer();
    if (file_exists('class/language/phpmailer.lang-en.php')) {
        $mail->SetLanguage('en', 'class/language/');
    } else {
        $mail->SetLanguage('en', '../class/language/');
    }
    if (isset($sendmethod) && $sendmethod == 'sendmail') {
        $mail->IssupportSendMail();
    } elseif (isset($sendmethod) && $sendmethod == 'smtp') {
        $mail->IsSMTP();
    } elseif (isset($sendmethod) && $sendmethod == 'mail') {
        $mail->IsMail();
    } elseif (isset($sendmethod) && $sendmethod == 'qmail') {
        $mail->IsQmail();
    }
    $mail->Host = $sockethost;
    if ($smtpauth == 'TRUE') {
        $mail->SMTPAuth = true;
        $mail->Username = $smtpauthuser;
        $mail->Password = $smtpauthpass;
    }
    if (!$response_flag && isset($_GET['caseid']) && ($_GET['caseid'] == 'NewTicket' || $_GET['caseid'] == 'view')) {
        $mail->From = $email;
        $mail->FromName = $name;
        $mail->AddReplyTo($email, $name);
    } else {
        $mail->From = $socketfrom;
        $mail->FromName = $socketfromname;
        $mail->AddReplyTo($socketreply, $socketreplyname);
    }
    $mail->IsHTML(False);
    $mail->Body = $message;
    $mail->Subject = $subject;
    if (!$response_flag && isset($_GET['caseid']) && ($_GET['caseid'] == 'NewTicket' || $_GET['caseid'] == 'view')) {
        $mail->AddAddress($socketfrom, $socketfromname);
    } else {
        $mail->AddAddress($email, $name);
    }
    if (!$mail->Send()) {
        return 'Error: ' . $mail->ErrorInfo;
    } else {
        return 'Email Sent. ' . $mail->ErrorInfo;
    }
    $mail->ClearAddresses();
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:49,代码来源:functions.php


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