• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP imap_rfc822_parse_adrlist函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _addOrganizer

 /**
  * Yet another problem: Outlook seems to remove the organizer from
  * the iCal when forwarding -- we put the original sender back in
  * as organizer.
  *
  * @param string        $icaltext  The ical message.
  * @param MIME_Headers  $from      The message sender.
  */
 function _addOrganizer(&$icaltxt, $from)
 {
     global $conf;
     if (isset($conf['kolab']['filter']['email_domain'])) {
         $email_domain = $conf['kolab']['filter']['email_domain'];
     } else {
         $email_domain = 'localhost';
     }
     $iCal = new Horde_Icalendar();
     $iCal->parsevCalendar($icaltxt);
     $vevent =& $iCal->findComponent('VEVENT');
     if ($vevent) {
         $organizer = $vevent->getAttribute('ORGANIZER', true);
         if (is_a($organizer, 'PEAR_Error')) {
             $adrs = imap_rfc822_parse_adrlist($from, $email_domain);
             if (count($adrs) > 0) {
                 $org_email = 'mailto:' . $adrs[0]->mailbox . '@' . $adrs[0]->host;
                 $org_name = $adrs[0]->personal;
                 if ($org_name) {
                     $vevent->setAttribute('ORGANIZER', $org_email, array('CN' => $org_name), false);
                 } else {
                     $vevent->setAttribute('ORGANIZER', $org_email, array(), false);
                 }
                 Horde::log(sprintf("Adding missing organizer '%s <%s>' to iCal.", $org_name, $org_email), 'DEBUG');
                 $icaltxt = $iCal->exportvCalendar();
             }
         }
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:37,代码来源:Outlook.php


示例2: getAddress

 /**
  * @param string $input RFC822 address string
  * @return Address
  */
 public static function getAddress($input)
 {
     $input = str_replace("\t", ' ', $input);
     $address = imap_rfc822_parse_adrlist($input, '');
     $name = isset($address[0]->personal) ? trim($address[0]->personal, '"') : null;
     $email = $address[0]->mailbox . '@' . $address[0]->host;
     return new Address($email, $name);
 }
开发者ID:soukicz,项目名称:mailgun,代码行数:12,代码来源:Decoder.php


示例3: parseRfcAddressList

 /**
  * Enter description here...
  *
  * @param string $string
  * @return array
  */
 static function parseRfcAddressList($input)
 {
     $addys = array();
     if (!is_array($input)) {
         $input = array($input);
     }
     foreach ($input as $string) {
         $addys += imap_rfc822_parse_adrlist($string, '');
     }
     return $addys;
 }
开发者ID:rmiddle,项目名称:cerb4,代码行数:17,代码来源:Utils.php


示例4: parse

 /**
  * @return AddressCollection
  */
 public static function parse($addressCollection)
 {
     $result = imap_rfc822_parse_adrlist($addressCollection, getHostname());
     $addressCollection = new static($result);
     return $addressCollection->map(function ($user) {
         if (!$user->host) {
             throw new Exception('Missing or invalid host name');
         }
         if ($user->host == '.SYNTAX-ERROR.') {
             throw new Exception('Missing or invalid host name');
         }
         $mailAddress = new MailAddress();
         if (property_exists($user, 'personal')) {
             $mailAddress->setUserName($user->personal);
         }
         $mailAddress->setMailbox($user->mailbox);
         $mailAddress->setHostname($user->host);
         return $mailAddress;
     });
 }
开发者ID:blar,项目名称:mail,代码行数:23,代码来源:AddressCollection.php


示例5: getMessages

 public function getMessages($email)
 {
     $messages = [];
     foreach ($this->query(['to' => $email, 'on' => date('d F Y'), 'unseen' => false]) as $messageId) {
         $structure = imap_fetchstructure($this->connections[$email], $messageId);
         $encoding = isset($structure->parts) ? reset($structure->parts) : $structure;
         $message = imap_fetch_overview($this->connections[$email], $messageId);
         $message = reset($message);
         $processFunction = $this->detectProcessFunction($encoding->encoding);
         $message->subject = $processFunction($message->subject);
         $message->body = $this->getMessageBody($email, $messageId, $processFunction, reset($structure->parameters));
         foreach (['from', 'to'] as $direction) {
             $address = imap_rfc822_parse_adrlist(imap_utf8($message->{$direction}), '');
             $address = reset($address);
             $message->{$direction} = "{$address->mailbox}@{$address->host}";
         }
         $messages[] = (array) $message;
         imap_delete($this->connections[$email], $messageId);
     }
     return $messages;
 }
开发者ID:BR0kEN-,项目名称:TqExtension,代码行数:21,代码来源:Imap.php


示例6: GetRFC822Addresses

 function GetRFC822Addresses($address, &$addresses)
 {
     if (function_exists("imap_rfc822_parse_adrlist")) {
         $parsed_addresses = @imap_rfc822_parse_adrlist($address, $this->localhost);
         for ($entry = 0; $entry < count($parsed_addresses); $entry++) {
             if ($parsed_addresses[$entry]->host == ".SYNTAX-ERROR.") {
                 return $parsed_addresses[$entry]->mailbox . " " . $parsed_addresses[$entry]->host;
             }
             $parsed_address = $parsed_addresses[$entry]->mailbox . "@" . $parsed_addresses[$entry]->host;
             if (isset($addresses[$parsed_address])) {
                 $addresses[$parsed_address]++;
             } else {
                 $addresses[$parsed_address] = 1;
             }
         }
     } else {
         $length = strlen($address);
         for ($position = 0; $position < $length;) {
             $match = split($this->email_address_pattern, strtolower(substr($address, $position)), 2);
             if (count($match) < 2) {
                 break;
             }
             $position += strlen($match[0]);
             $next_position = $length - strlen($match[1]);
             $found = substr($address, $position, $next_position - $position);
             if (!strcmp($found, "")) {
                 break;
             }
             if (isset($addresses[$found])) {
                 $addresses[$found]++;
             } else {
                 $addresses[$found] = 1;
             }
             $position = $next_position;
         }
     }
     return "";
 }
开发者ID:laiello,项目名称:ya-playsms,代码行数:38,代码来源:smtp_message.php


示例7: parseAddressList

 public static function parseAddressList($string)
 {
     $data = [];
     foreach (imap_rfc822_parse_adrlist(strtr($string, ';', ','), self::INTERNAL_HOST) as $address) {
         isset($address->mailbox, $address->host) and $data[] = [$address->mailbox, $address->host, isset($address->personal) ? $address->personal : ''];
     }
     return $data;
 }
开发者ID:dapepe,项目名称:tymio,代码行数:8,代码来源:mail.php


示例8: saveRequestersPanelAction

 function saveRequestersPanelAction()
 {
     @($ticket_id = DevblocksPlatform::importGPC($_POST['ticket_id'], 'integer'));
     @($msg_id = DevblocksPlatform::importGPC($_POST['msg_id'], 'integer'));
     // Dels
     @($req_deletes = DevblocksPlatform::importGPC($_POST['req_deletes'], 'array', array()));
     if (!empty($req_deletes)) {
         foreach ($req_deletes as $del_id) {
             DAO_Ticket::deleteRequester($ticket_id, $del_id);
         }
     }
     // Adds
     @($req_adds = DevblocksPlatform::importGPC($_POST['req_adds'], 'string', ''));
     $req_list = DevblocksPlatform::parseCrlfString($req_adds);
     $req_addys = array();
     if (is_array($req_list) && !empty($req_list)) {
         foreach ($req_list as $req) {
             if (empty($req)) {
                 continue;
             }
             $rfc_addys = imap_rfc822_parse_adrlist($req, 'localhost');
             foreach ($rfc_addys as $rfc_addy) {
                 $addy = $rfc_addy->mailbox . '@' . $rfc_addy->host;
                 if (null != ($req_addy = CerberusApplication::hashLookupAddress($addy, true))) {
                     DAO_Ticket::createRequester($req_addy->id, $ticket_id);
                 }
             }
         }
     }
     $requesters = DAO_Ticket::getRequestersByTicket($ticket_id);
     $list = array();
     foreach ($requesters as $requester) {
         $list[] = $requester->email;
     }
     echo implode(', ', $list);
     exit;
 }
开发者ID:jsjohnst,项目名称:cerb4,代码行数:37,代码来源:display.php


示例9: emailAddressToHTML

    function emailAddressToHTML($_emailAddress)
    {
        // create some nice formated HTML for senderaddress
        if ($_emailAddress == 'undisclosed-recipients: ;') {
            return $_emailAddress;
        }
        $addressData = imap_rfc822_parse_adrlist($this->bofelamimail->decode_header($_emailAddress), '');
        if (is_array($addressData)) {
            $senderAddress = '';
            while (list($key, $val) = each($addressData)) {
                if (!empty($senderAddress)) {
                    $senderAddress .= ", ";
                }
                if (!empty($val->personal)) {
                    $tempSenderAddress = $val->mailbox . "@" . $val->host;
                    $newSenderAddress = imap_rfc822_write_address($val->mailbox, $val->host, $val->personal);
                    $linkData = array('menuaction' => 'felamimail.uicompose.compose', 'send_to' => base64_encode($newSenderAddress));
                    $link = $GLOBALS['phpgw']->link('/index.php', $linkData);
                    $senderAddress .= sprintf('<a href="%s" title="%s">%s</a>', $link, @htmlentities($newSenderAddress, ENT_QUOTES, $this->displayCharset), @htmlentities($val->personal, ENT_QUOTES, $this->displayCharset));
                    $linkData = array('menuaction' => 'addressbook.uiaddressbook.add_email', 'add_email' => $tempSenderAddress, 'name' => $val->personal, 'referer' => $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']);
                    $urlAddToAddressbook = $GLOBALS['phpgw']->link('/index.php', $linkData);
                    $image = $GLOBALS['phpgw']->common->image('felamimail', 'sm_envelope');
                    $senderAddress .= sprintf('<a href="%s">
							<img src="%s" width="10" height="8" border="0" 
							align="absmiddle" alt="%s" 
							title="%s"></a>', $urlAddToAddressbook, $image, lang('add to addressbook'), lang('add to addressbook'));
                } else {
                    $tempSenderAddress = $val->mailbox . "@" . $val->host;
                    $linkData = array('menuaction' => 'felamimail.uicompose.compose', 'send_to' => base64_encode($tempSenderAddress));
                    $link = $GLOBALS['phpgw']->link('/index.php', $linkData);
                    $senderAddress .= sprintf('<a href="%s">%s</a>', $link, @htmlentities($tempSenderAddress, ENT_QUOTES, $this->displayCharset));
                    $linkData = array('menuaction' => 'addressbook.uiaddressbook.add_email', 'add_email' => $tempSenderAddress, 'referer' => $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']);
                    $urlAddToAddressbook = $GLOBALS['phpgw']->link('/index.php', $linkData);
                    $image = $GLOBALS['phpgw']->common->image('felamimail', 'sm_envelope');
                    $senderAddress .= sprintf('<a href="%s">
							<img src="%s" width="10" height="8" border="0" 
							align="absmiddle" alt="%s" 
							title="%s"></a>', $urlAddToAddressbook, $image, lang('add to addressbook'), lang('add to addressbook'));
                }
            }
            return $senderAddress;
        }
        // if something goes wrong, just return the original address
        return $_emailAddress;
    }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:45,代码来源:class.uidisplay.inc.php


示例10: doContactSendAction

 function doContactSendAction()
 {
     @($sFrom = DevblocksPlatform::importGPC($_POST['from'], 'string', ''));
     @($sSubject = DevblocksPlatform::importGPC($_POST['subject'], 'string', ''));
     @($sContent = DevblocksPlatform::importGPC($_POST['content'], 'string', ''));
     @($sCaptcha = DevblocksPlatform::importGPC($_POST['captcha'], 'string', ''));
     @($aFieldIds = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array()));
     @($aFollowUpQ = DevblocksPlatform::importGPC($_POST['followup_q'], 'array', array()));
     // Load the answers to any situational questions
     $aFollowUpA = array();
     if (is_array($aFollowUpQ)) {
         foreach ($aFollowUpQ as $idx => $q) {
             @($answer = DevblocksPlatform::importGPC($_POST['followup_a_' . $idx], 'string', ''));
             $aFollowUpA[$idx] = $answer;
         }
     }
     $umsession = $this->getSession();
     $fingerprint = parent::getFingerprint();
     $settings = CerberusSettings::getInstance();
     $default_from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM);
     $umsession->setProperty('support.write.last_from', $sFrom);
     $umsession->setProperty('support.write.last_subject', $sSubject);
     $umsession->setProperty('support.write.last_content', $sContent);
     //		$umsession->setProperty('support.write.last_followup_q',$aFollowUpQ);
     $umsession->setProperty('support.write.last_followup_a', $aFollowUpA);
     $sNature = $umsession->getProperty('support.write.last_nature', '');
     $captcha_enabled = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_CAPTCHA_ENABLED, 1);
     if (empty($sFrom) || $captcha_enabled && 0 != strcasecmp($sCaptcha, @$umsession->getProperty(UmScApp::SESSION_CAPTCHA, '***'))) {
         if (empty($sFrom)) {
             $umsession->setProperty('support.write.last_error', 'Invalid e-mail address.');
         } else {
             $umsession->setProperty('support.write.last_error', 'What you typed did not match the image.');
         }
         // [TODO] Need to report the captcha didn't match and redraw the form
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', $this->getPortal(), 'contact', 'step2')));
         return;
     }
     // Dispatch
     $to = $default_from;
     $subject = 'Contact me: Other';
     $sDispatch = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_DISPATCH, '');
     $dispatch = !empty($sDispatch) ? unserialize($sDispatch) : array();
     foreach ($dispatch as $k => $v) {
         if (md5($k) == $sNature) {
             $to = $v['to'];
             $subject = 'Contact me: ' . strip_tags($k);
             break;
         }
     }
     if (!empty($sSubject)) {
         $subject = $sSubject;
     }
     $fieldContent = '';
     if (!empty($aFollowUpQ)) {
         $fieldContent = "\r\n\r\n";
         $fieldContent .= "--------------------------------------------\r\n";
         if (!empty($sNature)) {
             $fieldContent .= $subject . "\r\n";
             $fieldContent .= "--------------------------------------------\r\n";
         }
         foreach ($aFollowUpQ as $idx => $q) {
             $answer = isset($aFollowUpA[$idx]) ? $aFollowUpA[$idx] : '';
             $fieldContent .= "Q) " . $q . "\r\n" . "A) " . $answer . "\r\n";
             if ($idx + 1 < count($aFollowUpQ)) {
                 $fieldContent .= "\r\n";
             }
         }
         $fieldContent .= "--------------------------------------------\r\n";
         "\r\n";
     }
     $message = new CerberusParserMessage();
     $message->headers['date'] = date('r');
     $message->headers['to'] = $to;
     $message->headers['subject'] = $subject;
     $message->headers['message-id'] = CerberusApplication::generateMessageId();
     $message->headers['x-cerberus-portal'] = 1;
     // Sender
     $fromList = imap_rfc822_parse_adrlist($sFrom, '');
     if (empty($fromList) || !is_array($fromList)) {
         return;
         // abort with message
     }
     $from = array_shift($fromList);
     $message->headers['from'] = $from->mailbox . '@' . $from->host;
     $message->body = 'IP: ' . $fingerprint['ip'] . "\r\n\r\n" . $sContent . $fieldContent;
     $ticket_id = CerberusParser::parseMessage($message);
     $ticket = DAO_Ticket::getTicket($ticket_id);
     // Auto-save any custom fields
     $fields = DAO_CustomField::getBySource('cerberusweb.fields.source.ticket');
     if (!empty($aFieldIds)) {
         foreach ($aFieldIds as $iIdx => $iFieldId) {
             if (!empty($iFieldId)) {
                 $field =& $fields[$iFieldId];
                 /* @var $field Model_CustomField */
                 $value = "";
                 switch ($field->type) {
                     case Model_CustomField::TYPE_SINGLE_LINE:
                     case Model_CustomField::TYPE_MULTI_LINE:
                         @($value = trim($aFollowUpA[$iIdx]));
                         break;
//.........这里部分代码省略.........
开发者ID:joegeck,项目名称:cerb4,代码行数:101,代码来源:UmScApp.php


示例11: send

 function send($_formData)
 {
     $bofelamimail =& CreateObject('felamimail.bofelamimail', $this->displayCharset);
     $mail =& CreateObject('phpgwapi.mailer_smtp');
     $messageIsDraft = false;
     $this->sessionData['identity'] = $_formData['identity'];
     $this->sessionData['to'] = $_formData['to'];
     $this->sessionData['cc'] = $_formData['cc'];
     $this->sessionData['bcc'] = $_formData['bcc'];
     $this->sessionData['folder'] = $_formData['folder'];
     $this->sessionData['replyto'] = $_formData['replyto'];
     $this->sessionData['subject'] = trim($_formData['subject']);
     $this->sessionData['body'] = $_formData['body'];
     $this->sessionData['priority'] = $_formData['priority'];
     $this->sessionData['signatureID'] = $_formData['signatureID'];
     $this->sessionData['disposition'] = $_formData['disposition'];
     $this->sessionData['mimeType'] = $_formData['mimeType'];
     $this->sessionData['to_infolog'] = $_formData['to_infolog'];
     // if the body is empty, maybe someone pasted something with scripts, into the message body
     // this should not happen anymore, unless you call send directly, since the check was introduced with the action command
     if (empty($this->sessionData['body'])) {
         // this is to be found with the egw_unset_vars array for the _POST['body'] array
         $name = '_POST';
         $key = 'body';
         #error_log($GLOBALS['egw_unset_vars'][$name.'['.$key.']']);
         if (isset($GLOBALS['egw_unset_vars'][$name . '[' . $key . ']'])) {
             $this->sessionData['body'] = self::_getCleanHTML($GLOBALS['egw_unset_vars'][$name . '[' . $key . ']']);
             $_formData['body'] = $this->sessionData['body'];
         }
         #error_log($this->sessionData['body']);
     }
     if (empty($this->sessionData['to']) && empty($this->sessionData['cc']) && empty($this->sessionData['bcc']) && empty($this->sessionData['folder'])) {
         $messageIsDraft = true;
     }
     #error_log(print_r($this->preferences,true));
     $identity = $this->preferences->getIdentity((int) $this->sessionData['identity']);
     $signature = $this->bosignatures->getSignature((int) $this->sessionData['signatureID']);
     #error_log($this->sessionData['identity']);
     #error_log(print_r($identity,true));
     // create the messages
     $this->createMessage($mail, $_formData, $identity, $signature);
     #print "<pre>". $mail->getMessageHeader() ."</pre><hr><br>";
     #print "<pre>". $mail->getMessageBody() ."</pre><hr><br>";
     #exit;
     $ogServer = $this->preferences->getOutgoingServer(0);
     #_debug_array($ogServer);
     $mail->Host = $ogServer->host;
     $mail->Port = $ogServer->port;
     // SMTP Auth??
     if ($ogServer->smtpAuth) {
         $mail->SMTPAuth = true;
         $mail->Username = $ogServer->username;
         $mail->Password = $ogServer->password;
     }
     // set a higher timeout for big messages
     @set_time_limit(120);
     #$mail->SMTPDebug = 10;
     if (count((array) $this->sessionData['to']) > 0 || count((array) $this->sessionData['cc']) > 0 || count((array) $this->sessionData['bcc']) > 0) {
         if (!$mail->Send()) {
             $this->errorInfo = $mail->ErrorInfo;
             return false;
         }
     }
     #error_log("Mail Sent.!");
     $folder = (array) $this->sessionData['folder'];
     if (isset($GLOBALS['phpgw_info']['user']['preferences']['felamimail']['sentFolder']) && $GLOBALS['phpgw_info']['user']['preferences']['felamimail']['sentFolder'] != 'none' && $messageIsDraft == false) {
         $folder[] = $GLOBALS['phpgw_info']['user']['preferences']['felamimail']['sentFolder'];
     }
     if ($messageIsDraft == true) {
         if (!empty($GLOBALS['phpgw_info']['user']['preferences']['felamimail']['draftFolder'])) {
             $this->sessionData['folder'] = array($GLOBALS['phpgw_info']['user']['preferences']['felamimail']['draftFolder']);
         }
     }
     $folder = array_unique($folder);
     #error_log("Number of Folders to move copy the message to:".count($folder));
     if (count($folder) > 0 || isset($this->sessionData['uid']) && isset($this->sessionData['messageFolder']) || isset($this->sessionData['forwardFlag']) && isset($this->sessionData['sourceFolder'])) {
         $bofelamimail =& CreateObject('felamimail.bofelamimail');
         $bofelamimail->openConnection();
         //$bofelamimail->reopen($this->sessionData['messageFolder']);
         #error_log("(re)opened Connection");
     }
     if (count($folder) > 0) {
         foreach ((array) $this->sessionData['bcc'] as $address) {
             $address_array = imap_rfc822_parse_adrlist($address, '');
             foreach ((array) $address_array as $addressObject) {
                 $emailAddress = $addressObject->mailbox . (!empty($addressObject->host) ? '@' . $addressObject->host : '');
                 $mailAddr[] = array($emailAddress, $addressObject->personal);
             }
         }
         $BCCmail = '';
         if (count($mailAddr) > 0) {
             $BCCmail = $mail->AddrAppend("Bcc", $mailAddr);
         }
         //$bofelamimail =& CreateObject('felamimail.bofelamimail');
         //$bofelamimail->openConnection();
         foreach ($folder as $folderName) {
             if ($bofelamimail->isSentFolder($folderName)) {
                 $flags = '\\Seen';
             } elseif ($bofelamimail->isDraftFolder($folderName)) {
                 $flags = '\\Draft';
//.........这里部分代码省略.........
开发者ID:HaakonME,项目名称:porticoestate,代码行数:101,代码来源:class.bocompose.inc.php


示例12: probe_url


//.........这里部分代码省略.........
            }
        } elseif ($mode == PROBE_NORMAL) {
            // Check email
            $orig_url = $url;
            if (strpos($orig_url, '@') && validate_email($orig_url)) {
                $x = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1", intval(local_user()));
                $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval(local_user()));
                if (count($x) && count($r)) {
                    $mailbox = construct_mailbox_name($r[0]);
                    $password = '';
                    openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']);
                    $mbox = email_connect($mailbox, $r[0]['user'], $password);
                    if (!$mbox) {
                        logger('probe_url: email_connect failed.');
                    }
                    unset($password);
                }
                if ($mbox) {
                    $msgs = email_poll($mbox, $orig_url);
                    logger('probe_url: searching ' . $orig_url . ', ' . count($msgs) . ' messages found.', LOGGER_DEBUG);
                    if (count($msgs)) {
                        $addr = $orig_url;
                        $network = NETWORK_MAIL;
                        $name = substr($url, 0, strpos($url, '@'));
                        $phost = substr($url, strpos($url, '@') + 1);
                        $profile = 'http://' . $phost;
                        // fix nick character range
                        $vcard = array('fn' => $name, 'nick' => $name, 'photo' => avatar_img($url));
                        $notify = 'smtp ' . random_string();
                        $poll = 'email ' . random_string();
                        $priority = 0;
                        $x = email_msg_meta($mbox, $msgs[0]);
                        if (stristr($x->from, $orig_url)) {
                            $adr = imap_rfc822_parse_adrlist($x->from, '');
                        } elseif (stristr($x->to, $orig_url)) {
                            $adr = imap_rfc822_parse_adrlist($x->to, '');
                        }
                        if (isset($adr)) {
                            foreach ($adr as $feadr) {
                                if (strcasecmp($feadr->mailbox, $name) == 0 && strcasecmp($feadr->host, $phost) == 0 && strlen($feadr->personal)) {
                                    $personal = imap_mime_header_decode($feadr->personal);
                                    $vcard['fn'] = "";
                                    foreach ($personal as $perspart) {
                                        if ($perspart->charset != "default") {
                                            $vcard['fn'] .= iconv($perspart->charset, 'UTF-8//IGNORE', $perspart->text);
                                        } else {
                                            $vcard['fn'] .= $perspart->text;
                                        }
                                    }
                                    $vcard['fn'] = notags($vcard['fn']);
                                }
                            }
                        }
                    }
                    imap_close($mbox);
                }
            }
        }
    }
    if ($mode == PROBE_NORMAL) {
        if (strlen($zot)) {
            $s = fetch_url($zot);
            if ($s) {
                $j = json_decode($s);
                if ($j) {
                    $network = NETWORK_ZOT;
开发者ID:robhell,项目名称:friendica,代码行数:67,代码来源:Scrape.php


示例13: parseAddresses

 /**
  * Takes in a string of Email Addresses and returns an Array of
  * addresses. 
  *
  * Example:
  * "craigslist.org" <[email protected]>
  *
  * will return:
  * Array
  * (   
  *     [0] => stdClass Object
  *          (   
  *              [mailbox] => noreply
  *              [host] => craigslist.org
  *              [personal] => craigslist.org
  *          )
  *
  *)
  *
  * Note: More then one Email Address can be entered as a parameter. An 
  * array containing N array entries (where N is the number of emails entered) 
  * will be returned.
  *
  */
 public function parseAddresses($adr)
 {
     $adrArray = imap_rfc822_parse_adrlist($adr, "#");
     return $adrArray;
 }
开发者ID:drvup,项目名称:Imap,代码行数:29,代码来源:Imap.php


示例14: imap_rfc822_parse_adrlist

         $tpl->assign('step', STEP_UPGRADE);
         $tpl->display('steps/redirect.tpl');
         exit;
     }
     break;
     // Personalize system information (title, timezone, language)
 // Personalize system information (title, timezone, language)
 case STEP_CONTACT:
     $settings = DevblocksPlatform::getPluginSettingsService();
     @($default_reply_from = DevblocksPlatform::importGPC($_POST['default_reply_from'], 'string', $settings->get('feg.core', FegSettings::DEFAULT_REPLY_FROM)));
     @($default_reply_personal = DevblocksPlatform::importGPC($_POST['default_reply_personal'], 'string', $settings->get('feg.core', FegSettings::DEFAULT_REPLY_PERSONAL)));
     @($app_title = DevblocksPlatform::importGPC($_POST['app_title'], 'string', $settings->get('feg.core', FegSettings::APP_TITLE, 'Feg - Fax Email Gateway')));
     @($form_submit = DevblocksPlatform::importGPC($_POST['form_submit'], 'integer'));
     if (!empty($form_submit)) {
         // && !empty($default_reply_from)
         $validate = imap_rfc822_parse_adrlist(sprintf("<%s>", $default_reply_from), "localhost");
         if (!empty($default_reply_from) && is_array($validate) && 1 == count($validate)) {
             $settings->set('feg.core', FegSettings::DEFAULT_REPLY_FROM, $default_reply_from);
         }
         if (!empty($default_reply_personal)) {
             $settings->set('feg.core', FegSettings::DEFAULT_REPLY_PERSONAL, $default_reply_personal);
         }
         if (!empty($app_title)) {
             $settings->set('feg.core', FegSettings::APP_TITLE, $app_title);
         }
         $tpl->assign('step', STEP_OUTGOING_MAIL);
         $tpl->display('steps/redirect.tpl');
         exit;
     }
     if (!empty($form_submit) && empty($default_reply_from)) {
         $tpl->assign('failed', true);
开发者ID:rmiddle,项目名称:feg,代码行数:31,代码来源:index.php


示例15: parseAddresses

 /**
  * Parse and validate a string containing one or more RFC822-style comma-separated email addresses
  * of the form "display name <address>" into an array of name/address pairs.
  * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available.
  * Note that quotes in the name part are removed.
  * @param string $addrstr The address list string
  * @param bool $useimap Whether to use the IMAP extension to parse the list
  * @return array
  * @link http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
  */
 public function parseAddresses($addrstr, $useimap = true)
 {
     $addresses = array();
     if ($useimap and function_exists('imap_rfc822_parse_adrlist')) {
         //Use this built-in parser if it's available
         $list = imap_rfc822_parse_adrlist($addrstr, '');
         foreach ($list as $address) {
             if ($address->host != '.SYNTAX-ERROR.') {
                 if ($this->validateAddress($address->mailbox . '@' . $address->host)) {
                     $addresses[] = array('name' => property_exists($address, 'personal') ? $address->personal : '', 'address' => $address->mailbox . '@' . $address->host);
                 }
             }
         }
     } else {
         //Use this simpler parser
         $list = explode(',', $addrstr);
         foreach ($list as $address) {
             $address = trim($address);
             //Is there a separate name part?
             if (strpos($address, '<') === false) {
                 //No separate name, just use the whole thing
                 if ($this->validateAddress($address)) {
                     $addresses[] = array('name' => '', 'address' => $address);
                 }
             } else {
                 list($name, $email) = explode('<', $address);
                 $email = trim(str_replace('>', '', $email));
                 if ($this->validateAddress($email)) {
                     $addresses[] = array('name' => trim(str_replace(array('"', "'"), '', $name)), 'address' => $email);
                 }
             }
         }
     }
     return $addresses;
 }
开发者ID:routenull0,项目名称:phpipam,代码行数:45,代码来源:class.phpmailer.php


示例16: processDsn

 protected function processDsn($messageId)
 {
     $result = array('email' => null, 'bounceType' => self::BOUNCE_HARD, 'action' => null, 'statusCode' => null, 'diagnosticCode' => null);
     $action = $statusCode = $diagnosticCode = null;
     // first part of DSN (Delivery Status Notification), human-readable explanation
     $dsnMessage = imap_fetchbody($this->_connection, $messageId, "1");
     $dsnMessageStructure = imap_bodystruct($this->_connection, $messageId, "1");
     if ($dsnMessageStructure->encoding == 4) {
         $dsnMessage = quoted_printable_decode($dsnMessage);
     } elseif ($dsnMessageStructure->encoding == 3) {
         $dsnMessage = base64_decode($dsnMessage);
     }
     // second part of DSN (Delivery Status Notification), delivery-status
     $dsnReport = imap_fetchbody($this->_connection, $messageId, "2");
     if (preg_match("/Original-Recipient: rfc822;(.*)/i", $dsnReport, $matches)) {
         $emailArr = imap_rfc822_parse_adrlist($matches[1], 'default.domain.name');
         if (isset($emailArr[0]->host) && $emailArr[0]->host != '.SYNTAX-ERROR.' && $emailArr[0]->host != 'default.domain.name') {
             $result['email'] = $emailArr[0]->mailbox . '@' . $emailArr[0]->host;
         }
     } else {
         if (preg_match("/Final-Recipient: rfc822;(.*)/i", $dsnReport, $matches)) {
             $emailArr = imap_rfc822_parse_adrlist($matches[1], 'default.domain.name');
             if (isset($emailArr[0]->host) && $emailArr[0]->host != '.SYNTAX-ERROR.' && $emailArr[0]->host != 'default.domain.name') {
                 $result['email'] = $emailArr[0]->mailbox . '@' . $emailArr[0]->host;
             }
         }
     }
     if (preg_match("/Action: (.+)/i", $dsnReport, $matches)) {
         $action = strtolower(trim($matches[1]));
     }
     if (preg_match("/Status: ([0-9\\.]+)/i", $dsnReport, $matches)) {
         $statusCode = $matches[1];
     }
     // Could be multi-line , if the new line is beginning with SPACE or HTAB
     if (preg_match("/Diagnostic-Code:((?:[^\n]|\n[\t ])+)(?:\n[^\t ]|\$)/is", $dsnReport, $matches)) {
         $diagnosticCode = $matches[1];
     }
     if (empty($result['email'])) {
         if (preg_match("/quota exceed.*<(\\S+@\\S+\\w)>/is", $dsnMessage, $matches)) {
             $result['email'] = $matches[1];
             $result['bounceType'] = self::BOUNCE_SOFT;
         }
     } else {
         // "failed" / "delayed" / "delivered" / "relayed" / "expanded"
         if ($action == 'failed') {
             $rules = $this->getRules();
             $foundMatch = false;
             foreach ($rules[self::DIAGNOSTIC_CODE_RULES] as $rule) {
                 if (preg_match($rule['regex'], $diagnosticCode, $matches)) {
                     $foundMatch = true;
                     $result['bounceType'] = $rule['bounceType'];
                     break;
                 }
             }
             if (!$foundMatch) {
                 foreach ($rules[self::DSN_MESSAGE_RULES] as $rule) {
                     if (preg_match($rule['regex'], $dsnMessage, $matches)) {
                         $foundMatch = true;
                         $result['bounceType'] = $rule['bounceType'];
                         break;
                     }
                 }
             }
             if (!$foundMatch) {
                 foreach ($rules[self::COMMON_RULES] as $rule) {
                     if (preg_match($rule['regex'], $dsnMessage, $matches)) {
                         $foundMatch = true;
                         $result['bounceType'] = $rule['bounceType'];
                         break;
                     }
                 }
             }
             if (!$foundMatch) {
                 $result['bounceType'] = self::BOUNCE_HARD;
             }
         } else {
             $result['bounceType'] = self::BOUNCE_SOFT;
         }
     }
     $result['action'] = $action;
     $result['statusCode'] = $statusCode;
     $result['diagnosticCode'] = $diagnosticCode;
     return $result;
 }
开发者ID:schpill,项目名称:thin,代码行数:84,代码来源:Bounce.php


示例17: getHeaders

 /**
  * Returns headers.
  *
  * @param string $pid Part Id
  * @return array
  * @throws \Jyxo\Mail\Parser\EmailNotExistException If no such email exists
  */
 public function getHeaders($pid = null)
 {
     // Parses headers
     $rawHeaders = $this->getRawHeaders($pid);
     if (null === $pid) {
         $msgno = imap_msgno($this->connection, $this->uid);
         if (0 === $msgno) {
             throw new Parser\EmailNotExistException('Email does not exist');
         }
         $headerInfo = imap_headerinfo($this->connection, $msgno);
     } else {
         $headerInfo = imap_rfc822_parse_headers($rawHeaders);
     }
     // Adds a header that the IMAP extension does not support
     if (preg_match("~Disposition-Notification-To:(.+?)(?=\r?\n(?:\\S|\r?\n))~is", $rawHeaders, $matches)) {
         $addressList = imap_rfc822_parse_adrlist($matches[1], '');
         // {''} is used because of CS rules
         $headerInfo->{'disposition_notification_toaddress'} = substr(trim($matches[1]), 0, 1024);
         $headerInfo->{'disposition_notification_to'} = array($addressList[0]);
     }
     $headers = array();
     static $mimeHeaders = array('toaddress', 'ccaddress', 'bccaddress', 'fromaddress', 'reply_toaddress', 'senderaddress', 'return_pathaddress', 'subject', 'fetchfrom', 'fetchsubject', 'disposition_notification_toaddress');
     foreach ($headerInfo as $key => $value) {
         if (!is_object($value) && !is_array($value)) {
             if (in_array($key, $mimeHeaders)) {
                 $headers[$key] = $this->decodeMimeHeader($value);
             } else {
                 $headers[$key] = $this->convertToUtf8($value);
             }
         }
     }
     // Adds "udate" if missing
     if (!empty($headerInfo->udate)) {
         $headers['udate'] = $headerInfo->udate;
     } elseif (!empty($headerInfo->date)) {
         $headers['udate'] = strtotime($headerInfo->date);
     } else {
         $headers['udate'] = time();
     }
     // Parses references
     $headers['references'] = isset($headers['references']) ? explode('> <', trim($headers['references'], '<>')) : array();
     static $types = array('to', 'cc', 'bcc', 'from', 'reply_to', 'sender', 'return_path', 'disposition_notification_to');
     for ($i = 0; $i < count($types); $i++) {
         $type = $types[$i];
         $headers[$type] = array();
         if (isset($headerInfo->{$type})) {
             foreach ($headerInfo->{$type} as $object) {
                 $newHeader = array();
                 foreach ($object as $attributeName => $attributeValue) {
                     if (!empty($attributeValue)) {
                         $newHeader[$attributeName] = 'personal' === $attributeName ? $this->decodeMimeHeader($attributeValue) : $this->convertToUtf8($attributeValue);
                     }
                 }
                 if (!empty($newHeader)) {
                     if (isset($newHeader['mailbox'], $newHeader['host'])) {
                         $newHeader['email'] = $newHeader['mailbox'] . '@' . $newHeader['host'];
                     } elseif (isset($newHeader['mailbox'])) {
                         $newHeader['email'] = $newHeader['mailbox'];
                     } else {
                         $newHeader['email'] = 'undisclosed-recipients';
                     }
                     $headers[$type][] = $newHeader;
                 }
             }
         }
     }
     // Adds X-headers
     if (preg_match_all("~(X(?:[\\-]\\w+)+):(.+?)(?=\r?\n(?:\\S|\r?\n))~is", $rawHeaders, $matches) > 0) {
         for ($i = 0; $i < count($matches[0]); $i++) {
             // Converts to the format used by imap_headerinfo()
             $key = str_replace('-', '_', strtolower($matches[1][$i]));
             // Removes line endings
             $value = strtr(trim($matches[2][$i]), array("\r" => '', "\n" => '', "\t" => ' '));
             $headers[$key] = $value;
         }
     }
     return $headers;
 }
开发者ID:JerryCR,项目名称:php-2,代码行数:85,代码来源:Parser.php


示例18: create

 /**
  * Creates a new e-mail address record.
  *
  * @param array $fields An array of fields=>values
  * @ret 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP imap_rfc822_parse_headers函数代码示例发布时间:2022-05-15
下一篇:
PHP imap_reopen函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap