本文整理汇总了PHP中imap_rfc822_parse_adrlist函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_rfc822_parse_adrlist函数的具体用法?PHP imap_rfc822_parse_adrlist怎么用?PHP imap_rfc822_parse_adrlist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_rfc822_parse_adrlist函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
}
}
示例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);
}
示例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;
}
示例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;
});
}
示例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;
}
示例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 "";
}
示例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;
}
示例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;
}
示例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;
}
示例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;
//.........这里部分代码省略.........
示例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';
//.........这里部分代码省略.........
示例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;
示例13: parseAddresses
/**
* Takes in a string of Email Addresses and returns an Array of
* addresses.
*
* Example:
* "craigslist.org" <noreply@craigslist.org>
*
* 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;
}
示例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);
示例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;
}