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


PHP parse_email函数代码示例

本文整理汇总了PHP中parse_email函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_email函数的具体用法?PHP parse_email怎么用?PHP parse_email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: password_restore_email

/**
 * @param string $input
 */
function password_restore_email($input)
{
    $use_password_verify = defined('SYNAPP_USE_PASSWORD_HASH_AUTHENTICATION') && (SYNAPP_USE_PASSWORD_HASH_AUTHENTICATION === true || is_string(SYNAPP_USE_PASSWORD_HASH_AUTHENTICATION) && (trim(strtolower(SYNAPP_USE_PASSWORD_HASH_AUTHENTICATION)) === 'on' || trim(strtolower(SYNAPP_USE_PASSWORD_HASH_AUTHENTICATION)) === 'true' || trim(strtolower(SYNAPP_USE_PASSWORD_HASH_AUTHENTICATION)) === '1')) ? true : false;
    $link = connect();
    if (parse_email($input, 0) == 0) {
        $sql = "SELECT * FROM users WHERE email = :input AND confirmed_email = 1";
        $isemail = true;
    } else {
        $sql = "SELECT * FROM users WHERE user = :input";
        $isemail = false;
    }
    $stmt = $link->prepare($sql);
    $stmt->bindValue(':input', $input, PDO::PARAM_STR);
    $stmt->execute();
    $link = null;
    $ua = $stmt->fetch(PDO::FETCH_ASSOC);
    $emailnotfound = true;
    $usernotfound = true;
    if (isset($ua['email']) && $ua['email'] !== '') {
        $usernotfound = false;
        if ($ua['email'] != '' && parse_email($ua['email']) == 0 && $ua['confirmed_email'] == 1) {
            $emailnotfound = false;
        }
    }
    if (!$emailnotfound) {
        $user = $ua['user'];
        $link = connect();
        $sql = "UPDATE users SET recovery = :recovery WHERE user = :user";
        $stmt = $link->prepare($sql);
        $prng = new synapp\info\tools\passwordgenerator\cryptosecureprng\CryptoSecurePRNG();
        $code = $prng->rand();
        $stmt->bindValue(':recovery', $use_password_verify ? password_hash($code, SYNAPP_PASSWORD_DEFAULT) : hash("sha256", $code), PDO::PARAM_STR);
        $stmt->bindValue(':user', $user);
        $stmt->execute();
        $email = $ua['email'];
        $to = $email;
        $subject = passresout('subject', $user);
        $mime_boundary = hash("sha256", time());
        $msg = passresout('email', $user, $email, $code, $mime_boundary);
        $headers = passresout('headers', $mime_boundary);
        mail($to, $subject, $msg, $headers);
        if ($isemail) {
            echo passresout('prmailsenttoaddress', $input);
        } else {
            echo passresout('prmailsenttouser', $input);
        }
    } else {
        if ($isemail) {
            echo passresout('emailnotfound', $input);
        } else {
            if ($usernotfound) {
                echo passresout('usernotfound', $input);
            } else {
                echo passresout('novalidemailassociated', $input);
            }
        }
    }
}
开发者ID:elcodedocle,项目名称:synapp,代码行数:61,代码来源:password_restore_email.php

示例2: pass_reset_email

 public function pass_reset_email()
 {
     $mail_setting = $this->settings_model->get_email_settings();
     $user_details = $this->get_user_details($this->input->post('email'));
     $message = $this->settings_model->get_email_template('FORGOT_PWD');
     $subject = $message['subject'];
     $emailbody = $message['content'];
     $key = genRandomString('32');
     $email = sha1(md5($this->input->post('email')));
     $confirm = "<a target='_blank' href='" . base_url() . "login_user/validate_pw_reset_credentials/{$key}/{$email}'>here</a>";
     $parseElement = array("USERNAME" => $user_details['f_name'], "SITENAME" => 'JobPortal', "LINK" => $confirm, "SITELINK" => base_url());
     $subject = parse_email($parseElement, $subject);
     $message = parse_email($parseElement, $emailbody);
     $data = array('subject' => $subject, 'message' => $message, 'to' => $this->input->post('email'));
     $this->update_activation_reset_key($key);
     send_email($mail_setting, $data);
 }
开发者ID:rajanpkr,项目名称:jobportal,代码行数:17,代码来源:login_user_model.php

示例3: reg_confirmation_email

 function reg_confirmation_email($activation_code)
 {
     $mail_setting = $this->settings_model->get_email_settings();
     $message = $this->settings_model->get_email_template('REGISTRATION');
     $subject = $message['subject'];
     $emailbody = $message['content'];
     $hash_email = sha1(md5($this->input->post('email')));
     $confirm = "Click <a href='" . site_url() . "register/activation_process/{$activation_code}/{$hash_email}'> here</a> to activate your JobPortal account";
     $parseElement = array("USERNAME" => $this->input->post("f_name"), "SITENAME" => 'JobPortal', "CONFIRM" => $confirm, "LINK" => base_url());
     $subject = parse_email($parseElement, $subject);
     $emailbody = parse_email($parseElement, $emailbody);
     //echo $emailbody;exit;
     $mail_params = array('to' => $this->input->post('email'), 'subject' => $subject, 'message' => $emailbody);
     if (send_email($mail_setting, $mail_params)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:rajanpkr,项目名称:jobportal,代码行数:19,代码来源:registration_model.php

示例4: notify

function notify($device, $title, $message)
{
    /// NOTE. Need full rewrite to universal function with message queues and multi-protocol (email,jabber,twitter)
    global $config, $debug;
    if ($config['alerts']['email']['enable'] && !$device['ignore']) {
        if (!get_dev_attrib($device, 'disable_notify')) {
            if ($config['alerts']['email']['default_only']) {
                $email = $config['alerts']['email']['default'];
            } else {
                if (get_dev_attrib($device, 'override_sysContact_bool')) {
                    $email = get_dev_attrib($device, 'override_sysContact_string');
                } elseif ($device['sysContact']) {
                    $email = $device['sysContact'];
                } else {
                    $email = $config['alerts']['email']['default'];
                }
            }
            $emails = parse_email($email);
            if ($emails) {
                // Mail backend params
                $params = array('localhost' => php_uname('n'));
                $backend = strtolower(trim($config['email_backend']));
                switch ($backend) {
                    case 'sendmail':
                        $params['sendmail_path'] = $config['email_sendmail_path'];
                        break;
                    case 'smtp':
                        $params['host'] = $config['email_smtp_host'];
                        $params['port'] = $config['email_smtp_port'];
                        if ($config['email_smtp_secure'] == 'ssl') {
                            $params['host'] = 'ssl://' . $config['email_smtp_host'];
                            if ($config['email_smtp_port'] == 25) {
                                $params['port'] = 465;
                                // Default port for SSL
                            }
                        }
                        $params['timeout'] = $config['email_smtp_timeout'];
                        $params['auth'] = $config['email_smtp_auth'];
                        $params['username'] = $config['email_smtp_username'];
                        $params['password'] = $config['email_smtp_password'];
                        if ($debug) {
                            $params['debug'] = TRUE;
                        }
                        break;
                    default:
                        $backend = 'mail';
                        // Default mailer backend
                }
                // Mail headers
                $headers = array();
                if (empty($config['email_from'])) {
                    $headers['From'] = '"Observium" <observium@' . $params['localhost'] . '>';
                    // Default "From:"
                } else {
                    foreach (parse_email($config['email_from']) as $from => $from_name) {
                        $headers['From'] = empty($from_name) ? $from : '"' . $from_name . '" <' . $from . '>';
                        // From:
                    }
                }
                $rcpts_full = '';
                $rcpts = '';
                foreach ($emails as $to => $to_name) {
                    $rcpts_full .= empty($to_name) ? $to . ', ' : '"' . $to_name . '" <' . $to . '>, ';
                    $rcpts .= $to . ', ';
                }
                $rcpts_full = substr($rcpts_full, 0, -2);
                // To:
                $rcpts = substr($rcpts, 0, -2);
                $headers['Subject'] = $title;
                // Subject:
                $headers['X-Priority'] = 3;
                // Mail priority
                $headers['X-Mailer'] = OBSERVIUM_PRODUCT . ' ' . OBSERVIUM_VERSION;
                // X-Mailer:
                #$headers['Content-type'] = 'text/html';
                $headers['Message-ID'] = '<' . md5(uniqid(time())) . '@' . $params['localhost'] . '>';
                $headers['Date'] = date('r', time());
                // Mail body
                $message_header = $config['page_title_prefix'] . "\n\n";
                $message_footer = "\n\nE-mail sent to: " . $rcpts . "\n";
                $message_footer .= "E-mail sent at: " . date($config['timestamp_format']) . "\n";
                $body = $message_header . $message . $message_footer;
                // Create mailer instance
                $mail =& Mail::factory($backend, $params);
                // Sending email
                $status = $mail->send($rcpts_full, $headers, $body);
                if (PEAR::isError($status)) {
                    echo 'Mailer Error: ' . $status->getMessage() . PHP_EOL;
                }
            }
        }
    }
}
开发者ID:skive,项目名称:observium,代码行数:93,代码来源:functions.inc.php

示例5: notify

function notify($device, $title, $message)
{
    global $config;
    if ($config['alerts']['email']['enable']) {
        if (!get_dev_attrib($device, 'disable_notify')) {
            if ($config['alerts']['email']['default_only']) {
                $email = $config['alerts']['email']['default'];
            } else {
                if (get_dev_attrib($device, 'override_sysContact_bool')) {
                    $email = get_dev_attrib($device, 'override_sysContact_string');
                } elseif ($device['sysContact']) {
                    $email = $device['sysContact'];
                } else {
                    $email = $config['alerts']['email']['default'];
                }
            }
            $emails = parse_email($email);
            if ($emails) {
                $message_header = $config['page_title_prefix'] . "\n\n";
                // FIXME: use different config element
                $message_footer = "\n\nE-mail sent to: ";
                $i = 0;
                $count = count($emails);
                foreach ($emails as $email => $email_name) {
                    $i++;
                    $message_footer .= $email;
                    if ($i < $count) {
                        $message_footer .= ", ";
                    } else {
                        $message_footer .= "\n";
                    }
                }
                $message_footer .= "E-mail sent at: " . date($config['timestamp_format']) . "\n";
                if (($err = send_mail($emails, $title, $message_header . $message . $message_footer)) !== true) {
                    echo "Mailer Error: " . $err . "\n";
                }
            }
        }
    }
}
开发者ID:rasssta,项目名称:librenms,代码行数:40,代码来源:functions.php

示例6: while

$email = '';
while (!feof($fd)) {
    $email .= fread($fd, 1024);
}
fclose($fd);
if (SITE_URL) {
    $domain = SITE_URL;
} else {
    // Break up the lines.
    $lines = explode("\n", $email);
    // Loop through the email one line at a time.  As soon as we find the To: line,
    // or the headers end, then stop looking.
    for ($i = 0; $i < count($lines); $i++) {
        if (preg_match('/^To:(.*)/', $lines[$i], $matches)) {
            // For combo name/email addresses, parse out the email address.
            $to = parse_email(trim($matches[1]));
            $to = explode('@', $to);
            if (!empty($to[1])) {
                $domain = $to[1];
            }
            break;
        } elseif (trim($lines[$i]) == '') {
            break;
        }
    }
}
if (!empty($domain)) {
    // Compose URL.
    $transport = USE_SSL ? 'https://' : 'http://';
    $port = SERVER_PORT ? ':' . SERVER_PORT : '';
    $query = SERVER_QUERY_STRING ? '?' . SERVER_QUERY_STRING : '';
开发者ID:jhaglund,项目名称:vozmob,代码行数:31,代码来源:mta_process_email.php

示例7: date

        }
        break;
    case 'mail':
    default:
        $backend = 'mail';
        // Default mailer backend
}
// Time sent RFC 2822
$time_rfc = date('r', time());
// Mail headers
$headers = array();
if (empty($config['email']['from'])) {
    $config['email']['from'] = 'Observium <observium@' . $localhost . '>';
    // Default "From:"
}
foreach (parse_email($config['email']['from']) as $from => $from_name) {
    $headers['From'] = empty($from_name) ? $from : '"' . $from_name . '" <' . $from . '>';
    // From:
    $headers['Return-Path'] = $from;
    break;
    // use only first entry
}
$rcpts = array();
$rcpts_full = array();
foreach ($emails as $to => $to_name) {
    $rcpts_full[] = empty($to_name) ? $to : '"' . trim($to_name) . '" <' . $to . '>';
    $rcpts[] = $to;
}
$rcpts_full = implode(', ', $rcpts_full);
$rcpts = implode(', ', $rcpts);
$headers['To'] = $rcpts_full;
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:email.inc.php

示例8: html_entity_decode

 $from = '"' . html_entity_decode($info['title'], ENT_QUOTES) . '" <' . $info['email'] . '>';
 if (!isset($_POST['email']) || count($_POST['email']) == 0) {
     echo '<p class="error">No pending members were checked and no ' . 'members have been approved or rejected.</p>';
 } else {
     // check which it is
     $selected = $_POST['selected'];
     if ($selected == 'APPROVE') {
         require_once 'Mail.php';
         foreach ($_POST['email'] as $email) {
             $success = approve_member($listing, $email);
             if (!$success) {
                 echo '<p class="error">Error approving member with ' . 'email address <i>' . $_REQUEST['email'] . '</i>.</p>';
             } else {
                 if ($info['emailapproved']) {
                     // send if there is
                     $body = parse_email('approved', $listing, $email);
                     // use send_email function
                     $mail_sent = send_email($email, $from, $subject, $body);
                 }
             }
         }
         echo '<p class="success">Finished approving selected members.</p>';
     } else {
         if ($selected == 'REJECT') {
             foreach ($_POST['email'] as $email) {
                 $success = delete_member($listing, $email);
                 if (!$success) {
                     echo '<p class="error">Error rejecting member with ' . 'email address <i>' . $_REQUEST['email'] . '</i>.</p>';
                 }
             }
             echo '<p class="success">Finished rejecting selected members.</p>';
开发者ID:adriculous,项目名称:enthusiast,代码行数:31,代码来源:members.php

示例9: get_alert_contacts

/**
 * Get contacts associated with selected notification type and alert ID
 * Currently know notification types: alert, syslog
 *
 * @param array  $device   Common device array
 * @param int    $alert_id Alert ID
 * @param string $notification_type Used type for notifications
 * @return array Array with transport -> endpoints lists
 */
function get_alert_contacts($device, $alert_id, $notification_type)
{
    if (!is_array($device)) {
        $device = device_by_id_cache($device);
    }
    $transports = array();
    if (!$device['ignore'] && !get_dev_attrib($device, 'disable_notify') && !$GLOBALS['config']['alerts']['disable']['all']) {
        // figure out which transport methods apply to an alert
        $sql = "SELECT * FROM `alert_contacts`";
        $sql .= " WHERE `contact_disabled` = 0 AND `contact_id` IN";
        $sql .= " (SELECT `contact_id` FROM `alert_contacts_assoc` WHERE `aca_type` = ? AND `alert_checker_id` = ?);";
        foreach (dbFetchRows($sql, array($notification_type, $alert_id)) as $alert_entry) {
            $transports[$alert_entry['contact_method']][] = $alert_entry;
        }
        if (empty($transports)) {
            // if alert_contacts table is not in use, fall back to default
            // hardcoded defaults for when there is no contact configured.
            $email = NULL;
            if ($GLOBALS['config']['email']['default_only']) {
                // default only mail
                $email = $GLOBALS['config']['email']['default'];
            } else {
                // default device contact
                if (get_dev_attrib($device, 'override_sysContact_bool')) {
                    $email = get_dev_attrib($device, 'override_sysContact_string');
                } else {
                    if (parse_email($device['sysContact'])) {
                        $email = $device['sysContact'];
                    } else {
                        $email = $GLOBALS['config']['email']['default'];
                    }
                }
            }
            if ($email != NULL) {
                $emails = parse_email($email);
                foreach ($emails as $email => $descr) {
                    $transports['email'][] = array('contact_endpoint' => '{"email":"' . $email . '"}', 'contact_descr' => $descr, 'contact_transport' => 'email');
                }
            }
        }
    }
    return $transports;
}
开发者ID:Natolumin,项目名称:observium,代码行数:52,代码来源:alerts.inc.php

示例10: testParseEmail

 /**
  * @dataProvider providerEmail
  */
 public function testParseEmail($string, $result)
 {
     $this->assertSame($result, parse_email($string));
 }
开发者ID:Natolumin,项目名称:observium,代码行数:7,代码来源:IncludesFunctionsTest.php

示例11: str_replace

 has 
            been sent. You will be notified when you have been added into 
            the actual members list. If two weeks have passed and you have 
            received no email, please <a href="mailto:<?php 
                echo str_replace('@', '&#' . ord('@') . ';', $info['email']);
                ?>
">email me</a> if you wish to check up on your form.</p>
<?php 
            } else {
                // email!
                $to = $email;
                $subject = $info['title'] . ' ' . ucfirst($info['listingtype']) . ' Information';
                //            $from = str_replace( ',', '', $info['title'] ) . // strip commas
                //               ' <' . $info['email'] . '>';
                $from = '"' . html_entity_decode($info['title'], ENT_QUOTES) . '" <' . $info['email'] . '>';
                $message = parse_email('signup', $listing, $email, $password);
                $message = stripslashes($message);
                // use send_email function
                $success_mail = send_email($to, $from, $subject, $message);
                if ($success_mail !== true) {
                    ?>
               <p class="show_join_processed_errormail">Your form has been 
               processed correctly, but unfortunately there was an error
               sending your application information to you. If you
               wish to receive information about your application, please feel
               free to <a href="mailto:<?php 
                    echo str_replace('@', '&#' . ord('@') . ';', $info['email']);
                    ?>
">email me</a> and I will personally 
               look into it. Please not I cannot send your password to you.</p>
开发者ID:adriculous,项目名称:enthusiast,代码行数:30,代码来源:show_join.php

示例12: change_email

/**
 * @param string $edit
 * @param PDO $link
 * @return bool
 */
function change_email($edit, $link)
{
    $error = 0;
    if (isset($_POST[$edit])) {
        $_POST[$edit] = trim($_POST[$edit]);
    }
    $change = isset($_POST['edit']) ? $_POST['edit'] == $edit && ($error = parse_email($_POST[$edit])) === 0 ? true : false : false;
    if ($change) {
        if ($_POST[$edit] === $_SESSION['user_array']['email']) {
            change($edit, $link);
            return true;
        }
    }
    if ($change) {
        if ($_POST[$edit] === "") {
            change($edit, $link);
            $_SESSION['user_array']['confirmed_email'] = chr(0);
            return true;
        }
        if (captcha_verify_word()) {
            $sql = "SELECT user, email FROM confirmed_emails where email = :email";
            $stmt = $link->prepare($sql);
            $stmt->bindValue(':email', $_POST[$edit], PDO::PARAM_STR);
            if ($stmt->execute() !== false && ($row = $stmt->fetch(PDO::FETCH_ASSOC))) {
                if ($row['user'] !== $_SESSION['user_array']['user']) {
                    $error = 3;
                }
            }
            if (!$error) {
                if (change($edit, $link)) {
                    send_confirmation_email($_POST[$edit], $link);
                    $_SESSION['user_array']['email'] = $_POST[$edit];
                    echo PR_EMAIL . ': ' . $_SESSION['user_array']['email'] . " ";
                    echo (ord($_SESSION['user_array']['hemail']) ? PR_HIDDEN : PR_VISIBLE) . " [<a href=\"profile.phtml?user=" . $_SESSION['user_array']['user'] . "&edit=email\">" . PR_EDIT . "</a>] <span style=color:red>" . PR_SENT_1_A . "</span><script type='text/javascript'>alert(\"" . PR_SENT_1 . "\\n" . PR_SENT_2 . "\")</script><br />" . PHP_EOL;
                    return false;
                }
            }
        } else {
            $error = 4;
        }
    }
    echo "<form id=\"editForm\" method=\"POST\">" . PR_EMAIL . ": <input type=\"text\" id=\"" . $edit . "\" name=\"" . $edit . "\" value=\"" . $_SESSION['user_array'][$edit] . "\" onfocus=\"javascript:document.getElementById('focusId').value='" . $edit . "';\" />";
    echo "<input type=\"hidden\" id=\"focusId\" name=\"focusId\" value=\"" . $edit . "\">" . PHP_EOL;
    echo "<input type=\"hidden\" name=\"edit\" value=\"" . $edit . "\">" . PHP_EOL;
    echo "<input type=\"hidden\" name=\"user\" value=\"" . $_SESSION['user_array']['user'] . "\">" . PHP_EOL;
    echo "<input type=\"checkbox\" name=\"h" . $edit . "\" value=\"true\"";
    if (ord($_SESSION['user_array']['h' . $edit])) {
        echo " checked=\"checked\" ";
    }
    echo '/>' . PR_HIDE;
    switch ($error) {
        case 1:
            echo "<span style=\"color:red\"> " . PR_ERR_MAIL_LONG . "</span><script type='text/javascript'>focusId='" . $edit . "'</script>";
            break;
        case 2:
            echo "<span style=\"color:red\"> " . PR_ERR_MAIL_INVALID . "</span><script type='text/javascript'>focusId='" . $edit . "'</script>";
            break;
        case 3:
            echo "<span style=\"color:red\"> " . PR_ERR_MAIL_ALREADY_ASSOC . "</span><script type='text/javascript'>focusId='" . $edit . "';document.getElementById('" . $edit . "').value='" . $_POST[$edit] . "';</script>";
            break;
    }
    echo "<br /><span id=\"captchaImage\" style=\"border:0;width:140px;\"><img src=\"." . SYNAPP_CAPTCHA_PATH . "/captcha.image.php?nocache=" . hash("sha256", time() . mt_rand()) . "\" alt=\"captcha\"/></span><a \nhref=\"#\" onclick=\"updateCaptcha(null, '." . SYNAPP_CAPTCHA_PATH . "' );return false;\"><img src=\"." . SYNAPP_UI_RESOURCES_PATH . "/images/refresh.png\" style=\"border:0\" alt=\"" . PR_REFRESH . "\" title=\"" . PR_REFRESH . "\"/></a>";
    echo "<br />" . PR_CAPT . "<input type=\"text\" id=\"magicword\" " . "onfocus=\"javascript:document.getElementById('focusId').value='magicword';\" name=\"magicword\" autocomplete=\"off\" />";
    if ($error == 4) {
        echo "<span style=\"color:red\"> " . PR_ERR_CAPT . "</span><script type='text/javascript'>" . "focusId='magicword';document.getElementById('" . $edit . "').value='" . $_POST[$edit] . "';</script>";
    }
    echo '<br /></form>' . PHP_EOL;
    if (isset($_GET['alert']) && !count($_POST)) {
        if ($_GET['alert'] === "true") {
            echo "<script type='text/javascript'>alert(\"" . PR_VALIDATE_MAIL . "\")</script>";
        }
    }
    return false;
}
开发者ID:elcodedocle,项目名称:synapp,代码行数:79,代码来源:profile_edit.php

示例13: sendJobNotification

 private function sendJobNotification($email)
 {
     $mail_setting = $this->settings_model->get_email_settings();
     $message = $this->settings_model->get_email_template('NOTIFY_USER');
     $subject = $message['subject'];
     $emailbody = $message['content'];
     $parseElement = array("USERNAME" => $email, "SITENAME" => 'JobPortal', "SITELINK" => base_url());
     $subject = parse_email($parseElement, $subject);
     $emailbody = parse_email($parseElement, $emailbody);
     $mail_params = array('to' => $email, 'subject' => $subject, 'message' => $emailbody);
     if (send_email($mail_setting, $mail_params)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:rajanpkr,项目名称:jobportal,代码行数:16,代码来源:Employer_profile.php

示例14: send_mail

function send_mail($emails, $subject, $message, $html = false)
{
    global $config;
    if (is_array($emails) || ($emails = parse_email($emails))) {
        if (!class_exists("PHPMailer", false)) {
            include_once $config['install_dir'] . "/includes/phpmailer/class.phpmailer.php";
        }
        $mail = new PHPMailer();
        $mail->Hostname = php_uname('n');
        if (empty($config['email_from'])) {
            $config['email_from'] = '"' . $config['project_name'] . '" <' . $config['email_user'] . '@' . $mail->Hostname . '>';
        }
        foreach (parse_email($config['email_from']) as $from => $from_name) {
            $mail->setFrom($from, $from_name);
        }
        foreach ($emails as $email => $email_name) {
            $mail->addAddress($email, $email_name);
        }
        $mail->Subject = $subject;
        $mail->XMailer = $config['project_name_version'];
        $mail->CharSet = 'utf-8';
        $mail->WordWrap = 76;
        $mail->Body = $message;
        if ($html) {
            $mail->isHTML(true);
        }
        switch (strtolower(trim($config['email_backend']))) {
            case 'sendmail':
                $mail->Mailer = 'sendmail';
                $mail->Sendmail = $config['email_sendmail_path'];
                break;
            case 'smtp':
                $mail->isSMTP();
                $mail->Host = $config['email_smtp_host'];
                $mail->Timeout = $config['email_smtp_timeout'];
                $mail->SMTPAuth = $config['email_smtp_auth'];
                $mail->SMTPSecure = $config['email_smtp_secure'];
                $mail->Port = $config['email_smtp_port'];
                $mail->Username = $config['email_smtp_username'];
                $mail->Password = $config['email_smtp_password'];
                $mail->SMTPDebug = false;
                break;
            default:
                $mail->Mailer = 'mail';
                break;
        }
        return $mail->send() ? true : $mail->ErrorInfo;
    }
}
开发者ID:syzdek,项目名称:librenms,代码行数:49,代码来源:functions.php

示例15: dbFetchCell

                   $email = $device['sysContact'];
               } else {
                   $email = $config['email']['default'];
               }
           }
           // lookup additional email addresses for first device random alert_id
           $alert_id = dbFetchCell('SELECT `alert_test_id` FROM `alert_table` WHERE `device_id` = ?', array($device['device_id']));
           $sql = "SELECT `contact_descr`, `contact_endpoint` FROM `alert_contacts`";
           $sql .= " WHERE `contact_disabled` = 0 AND `contact_method` = 'email'";
           $sql .= " AND `contact_id` IN";
           $sql .= " (SELECT `alert_contact_id` FROM `alert_contacts_assoc` WHERE `alert_checker_id` = ?);";
           foreach (dbFetchRows($sql, array($alert_id)) as $entry) {
               $email .= "," . $entry['contact_descr'] . " <" . $entry['contact_endpoint'] . ">";
           }
       }
       $emails = parse_email($email);
       if ($emails) {
           $rcpts_full = array();
           foreach ($emails as $to => $to_name) {
               $rcpts_full[] = empty($to_name) ? $to : '"' . trim($to_name) . '" <' . $to . '>';
           }
           $rcpts_full = implode(', ', $rcpts_full);
           print_message("尝试发送测试通知 %W" . $device['hostname'] . "%n 到这些邮箱:\n  %g{$rcpts_full}%n", 'color', FALSE);
           // Create multipart (plain+html) message
           $template_html = '<html>
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
 </head>
 <body>
   <tt>{{MESSAGE}}</tt><br />
 </body>
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:test_mail.php


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