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


PHP eZMail::extractEmail方法代码示例

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


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

示例1: sendMail

 function sendMail(eZMail $mail)
 {
     $ini = eZINI::instance();
     $parameters = array();
     $parameters['host'] = $ini->variable('MailSettings', 'TransportServer');
     $parameters['helo'] = $ini->variable('MailSettings', 'SenderHost');
     $parameters['port'] = $ini->variable('MailSettings', 'TransportPort');
     $parameters['connectionType'] = $ini->variable('MailSettings', 'TransportConnectionType');
     $user = $ini->variable('MailSettings', 'TransportUser');
     $password = $ini->variable('MailSettings', 'TransportPassword');
     if ($user and $password) {
         $parameters['auth'] = true;
         $parameters['user'] = $user;
         $parameters['pass'] = $password;
     }
     /* If email sender hasn't been specified or is empty
      * we substitute it with either MailSettings.EmailSender or AdminEmail.
      */
     if (!$mail->senderText()) {
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
         if (!$emailSender) {
             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
         }
         eZMail::extractEmail($emailSender, $emailSenderAddress, $emailSenderName);
         if (!eZMail::validate($emailSenderAddress)) {
             $emailSender = false;
         }
         if ($emailSender) {
             $mail->setSenderText($emailSender);
         }
     }
     $excludeHeaders = $ini->variable('MailSettings', 'ExcludeHeaders');
     if (count($excludeHeaders) > 0) {
         $mail->Mail->appendExcludeHeaders($excludeHeaders);
     }
     $options = new ezcMailSmtpTransportOptions();
     if ($parameters['connectionType']) {
         $options->connectionType = $parameters['connectionType'];
     }
     $smtp = new ezcMailSmtpTransport($parameters['host'], $user, $password, $parameters['port'], $options);
     // If in debug mode, send to debug email address and nothing else
     if ($ini->variable('MailSettings', 'DebugSending') == 'enabled') {
         $mail->Mail->to = array(new ezcMailAddress($ini->variable('MailSettings', 'DebugReceiverEmail')));
         $mail->Mail->cc = array();
         $mail->Mail->bcc = array();
     }
     // send() from ezcMailSmtpTransport doesn't return anything (it uses exceptions in case
     // something goes bad)
     try {
         eZPerfLogger::accumulatorStart('mail_sent');
         $smtp->send($mail->Mail);
         eZPerfLogger::accumulatorStop('mail_sent');
     } catch (ezcMailException $e) {
         eZPerfLogger::accumulatorStop('mail_send');
         eZDebug::writeError($e->getMessage(), __METHOD__);
         return false;
     }
     // return true in case of no exceptions
     return true;
 }
开发者ID:gggeek,项目名称:ezperformancelogger,代码行数:60,代码来源:ezsmtptracingtransport.php

示例2: testExtractEmail

 /**
  * @dataProvider providerTestExtractEmail
  */
 public function testExtractEmail($recipient, $name, $email)
 {
     eZMail::extractEmail($recipient, $extractedEmail, $extractedName);
     self::assertEquals($extractedEmail, $email);
     self::assertEquals($extractedName, $name);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:9,代码来源:ezmail_test.php

示例3: microtime_float2

$time_start = microtime_float2();
$smtp = getConnection($active_server, $serverlist);
$allowPersistent = $mailSettings->variable('SMTPClusterSettings', 'PersistentConnection') == 'enabled' ? true : false;
for ($i = 0; $i < count($mailFiles); $i++) {
    // sending message
    $email = file_get_contents($mailFiles[$i]);
    $lines = file($mailFiles[$i]);
    // get from and to
    $regex = regexEmail();
    $expression = "/({$regex})/";
    preg_match_all($expression, $lines[1], $matches);
    $from_address = array_pop($matches[1]);
    preg_match_all($expression, $lines[7], $matches);
    $to_address = array_pop($matches[1]);
    eZMail::extractEmail($from_address, $from, $name);
    eZMail::extractEmail($to_address, $to, $name);
    if (eZMail::validate($from) && eZMail::validate($to)) {
        if ($smtp->send($from, $to, $email)) {
            $cli->output(".", false);
            // rename file on hdd
            eZFile::rename($mailFiles[$i], $mailFiles[$i] . ".send");
            if (!$allowPersistent) {
                $smtp->quit();
                $smtp = getConnection($active_server, $serverlist);
            }
        } else {
            if (count($serverlist) > 1) {
                // retrying other server
                $active_server = nextConnection($active_server, $serverlist, $i + 1);
                $smtp = getConnection($active_server, $serverlist);
                $try = 1;
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:cluster_send.php

示例4: unsubscribe

function unsubscribe($address_string, $list_name)
{
    $subscription_list = eZSubscriptionList::fetch($list_name);
    eZMail::extractEmail($address_string, $email, $name);
    if ($email) {
        $subscription = eZSubscription::fetchByEmailSubscriptionListID($email, $subscription_list->attribute('id'));
        if ($subscription) {
            if ($subscription->attribute('status') == eZSubscription::StatusApproved) {
                $subscription->setAttribute('status', eZSubscription::StatusRemovedSelf);
                $subscription->sync();
                return $subscription;
            }
        }
    }
    return false;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:16,代码来源:email_subscribe.php


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