本文整理汇总了PHP中Mail_mimeDecode::_splitBodyHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail_mimeDecode::_splitBodyHeader方法的具体用法?PHP Mail_mimeDecode::_splitBodyHeader怎么用?PHP Mail_mimeDecode::_splitBodyHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail_mimeDecode
的用法示例。
在下文中一共展示了Mail_mimeDecode::_splitBodyHeader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendMail
//.........这里部分代码省略.........
}
}
$envelopefrom = "-f{$v}";
ini_set('sendmail_from', $v);
$fromaddr = $v;
$v_parts = explode(" ", str_replace(">", "", str_replace("<", "", $v)));
if ($map_user_fullname && isset($map_user_fullname[$this->_username])) {
$v = '"' . $map_user_fullname[$this->_username] . '" <' . $v_parts[sizeof($v_parts) - 1] . '>';
}
if ($headers) {
$headers .= "\n";
}
$headers .= 'From: ' . $v;
}
// set "Return-Path" header if not set on the device
if (IMAP_DEFAULTFROM && !$returnPathSet) {
if (IMAP_DEFAULTFROM == 'username') {
$v = $this->_username;
} else {
if (IMAP_DEFAULTFROM == 'domain') {
$v = $this->_domain;
} else {
$v = $this->_username . IMAP_DEFAULTFROM;
}
}
if ($headers) {
$headers .= "\n";
}
$headers .= 'Return-Path: ' . $v;
}
// if this is a multipart message with a boundary, we must use the original body
if ($use_orgbody) {
debugLog("IMAP-Sendmail: use_orgbody = true");
list(, $body) = $mobj->_splitBodyHeader($rfc822);
$repl_body = $this->getBody($message);
} else {
debugLog("IMAP-Sendmail: use_orgbody = false");
$body = $this->getBody($message);
}
if (isset($smartdata['replacemime']) && $smartdata['replacemime'] == true && isset($message->ctype_primary)) {
if ($headers) {
$headers .= "\n";
}
$headers .= "Content-Type: " . $message->ctype_primary . "/" . $message->ctype_secondary . (isset($message->ctype_parameters['boundary']) ? ";\n\tboundary=" . $message->ctype_parameters['boundary'] : "");
}
$body = str_replace("\r", "", $body);
// reply
if ($smartdata['task'] == 'reply' && isset($smartdata['itemid']) && isset($smartdata['folderid']) && $smartdata['itemid'] && $smartdata['folderid'] && (!isset($smartdata['replacemime']) || isset($smartdata['replacemime']) && $smartdata['replacemime'] == false)) {
$this->imap_reopenFolder($smartdata['folderid']);
// receive entire mail (header + body) to decode body correctly
if (defined("IMAP_USE_FETCHHEADER") && IMAP_USE_FETCHHEADER === false) {
$origmail = @imap_fetchbody($this->_mbox, $smartdata['itemid'], "", FT_UID | FT_PEEK);
} else {
$origmail = @imap_fetchheader($this->_mbox, $smartdata['itemid'], FT_UID) . @imap_body($this->_mbox, $smartdata['itemid'], FT_PEEK | FT_UID);
}
$mobj2 = new Mail_mimeDecode($origmail);
// receive only body
$body .= $this->getBody($mobj2->decode(array('decode_headers' => false, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $origmail, 'crlf' => "\n", 'charset' => 'utf-8')));
// unset mimedecoder & origmail - free memory
unset($mobj2);
unset($origmail);
}
// encode the body to base64 if it was sent originally in base64 by the pda
// the encoded body is included in the forward
if ($body_base64 && !$use_orgbody && !isset($forward)) {
debugLog("IMAP-Sendmail: body_base64 = true and use_orgbody = false");
示例2: SendMail
//.........这里部分代码省略.........
if (IMAP_DEFAULTFROM && !$changedfrom) {
if (IMAP_DEFAULTFROM == 'username') {
$v = $this->_username;
} else {
if (IMAP_DEFAULTFROM == 'domain') {
$v = $this->_domain;
} else {
$v = $this->_username . IMAP_DEFAULTFROM;
}
}
if ($headers) {
$headers .= "\n";
}
$headers .= 'From: ' . $v;
}
// set "Return-Path" header if not set on the device
if (IMAP_DEFAULTFROM && !$returnPathSet) {
if (IMAP_DEFAULTFROM == 'username') {
$v = $this->_username;
} else {
if (IMAP_DEFAULTFROM == 'domain') {
$v = $this->_domain;
} else {
$v = $this->_username . IMAP_DEFAULTFROM;
}
}
if ($headers) {
$headers .= "\n";
}
$headers .= 'Return-Path: ' . $v;
}
// if this is a multipart message with a boundary, we must use the original body
if ($use_orgbody) {
list(, $body) = $mobj->_splitBodyHeader($rfc822);
} else {
$body = $this->getBody($message);
}
// reply
if (isset($reply) && isset($parent) && $reply && $parent) {
$this->imap_reopenFolder($parent);
// receive entire mail (header + body) to decode body correctly
$origmail = @imap_fetchheader($this->_mbox, $reply, FT_PREFETCHTEXT | FT_UID) . @imap_body($this->_mbox, $reply, FT_PEEK | FT_UID);
$mobj2 = new Mail_mimeDecode($origmail);
// receive only body
$body .= $this->getBody($mobj2->decode(array('decode_headers' => false, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $origmail, 'crlf' => "\n", 'charset' => 'utf-8')));
// unset mimedecoder & origmail - free memory
unset($mobj2);
unset($origmail);
}
// encode the body to base64 if it was sent originally in base64 by the pda
// the encoded body is included in the forward
if ($body_base64) {
$body = base64_encode($body);
}
// forward
if (isset($forward) && isset($parent) && $forward && $parent) {
$this->imap_reopenFolder($parent);
// receive entire mail (header + body)
$origmail = @imap_fetchheader($this->_mbox, $forward, FT_PREFETCHTEXT | FT_UID) . @imap_body($this->_mbox, $forward, FT_PEEK | FT_UID);
// build a new mime message, forward entire old mail as file
list($aheader, $body) = $this->mail_attach("forwarded_message.eml", strlen($origmail), $origmail, $body, $forward_h_ct, $forward_h_cte);
// unset origmail - free memory
unset($origmail);
// add boundary headers
$headers .= "\n" . $aheader;
}
示例3: SendMail
//.........这里部分代码省略.........
if (IMAP_DEFAULTFROM == 'username') {
$v = $this->username;
} else {
if (IMAP_DEFAULTFROM == 'domain') {
$v = $this->domain;
} else {
$v = $this->username . IMAP_DEFAULTFROM;
}
}
if ($headers) {
$headers .= "\n";
}
$headers .= 'From: ' . $v;
$envelopefrom = "-f{$v}";
}
// set "Return-Path" header if not set on the device
if (IMAP_DEFAULTFROM && !$returnPathSet) {
if (IMAP_DEFAULTFROM == 'username') {
$v = $this->username;
} else {
if (IMAP_DEFAULTFROM == 'domain') {
$v = $this->domain;
} else {
$v = $this->username . IMAP_DEFAULTFROM;
}
}
if ($headers) {
$headers .= "\n";
}
$headers .= 'Return-Path: ' . $v;
}
// if this is a multipart message with a boundary, we must use the original body
if ($use_orgbody) {
list(, $body) = $mobj->_splitBodyHeader($sm->mime);
$repl_body = $this->getBody($message);
} else {
$body = $this->getBody($message);
}
// reply
if ($sm->replyflag && $parent) {
$this->imap_reopenFolder($parent);
// receive entire mail (header + body) to decode body correctly
$origmail = @imap_fetchheader($this->mbox, $reply, FT_UID) . @imap_body($this->mbox, $reply, FT_PEEK | FT_UID);
if (!$origmail) {
throw new StatusException(sprintf("BackendIMAP->SendMail(): Could not open message id '%s' in folder id '%s' to be replied: %s", $reply, $parent, imap_last_error()), SYNC_COMMONSTATUS_ITEMNOTFOUND);
}
$mobj2 = new Mail_mimeDecode($origmail);
// receive only body
$body .= $this->getBody($mobj2->decode(array('decode_headers' => false, 'decode_bodies' => true, 'include_bodies' => true, 'charset' => 'utf-8')));
// unset mimedecoder & origmail - free memory
unset($mobj2);
unset($origmail);
}
// encode the body to base64 if it was sent originally in base64 by the pda
// contrib - chunk base64 encoded body
if ($body_base64 && !$sm->forwardflag) {
$body = chunk_split(base64_encode($body));
}
// forward
if ($sm->forwardflag && $parent) {
$this->imap_reopenFolder($parent);
// receive entire mail (header + body)
$origmail = @imap_fetchheader($this->mbox, $forward, FT_UID) . @imap_body($this->mbox, $forward, FT_PEEK | FT_UID);
if (!$origmail) {
throw new StatusException(sprintf("BackendIMAP->SendMail(): Could not open message id '%s' in folder id '%s' to be forwarded: %s", $forward, $parent, imap_last_error()), SYNC_COMMONSTATUS_ITEMNOTFOUND);
}
示例4: SendMail
//.........这里部分代码省略.........
if (IMAP_DEFAULTFROM == 'username') {
$v = $this->_username;
} else {
if (IMAP_DEFAULTFROM == 'domain') {
$v = $this->_domain;
} else {
$v = $this->_username . IMAP_DEFAULTFROM;
}
}
if ($headers) {
$headers .= "\n";
}
$headers .= 'From: ' . $v;
$envelopefrom = "-f{$v}";
}
// set "Return-Path" header if not set on the device
if (IMAP_DEFAULTFROM && !$returnPathSet) {
if (IMAP_DEFAULTFROM == 'username') {
$v = $this->_username;
} else {
if (IMAP_DEFAULTFROM == 'domain') {
$v = $this->_domain;
} else {
$v = $this->_username . IMAP_DEFAULTFROM;
}
}
if ($headers) {
$headers .= "\n";
}
$headers .= 'Return-Path: ' . $v;
}
// if this is a multipart message with a boundary, we must use the original body
if ($use_orgbody) {
list(, $body) = $mobj->_splitBodyHeader($rfc822);
$repl_body = $this->getBody($message);
} else {
$body = $this->getBody($message);
}
// reply
if ($reply && $parent) {
$this->imap_reopenFolder($parent);
// receive entire mail (header + body) to decode body correctly
$origmail = @imap_fetchheader($this->_mbox, $reply, FT_UID) . @imap_body($this->_mbox, $reply, FT_PEEK | FT_UID);
$mobj2 = new Mail_mimeDecode($origmail);
// receive only body
$body .= $this->getBody($mobj2->decode(array('decode_headers' => false, 'decode_bodies' => true, 'include_bodies' => true, 'charset' => 'utf-8')));
// unset mimedecoder & origmail - free memory
unset($mobj2);
unset($origmail);
}
// encode the body to base64 if it was sent originally in base64 by the pda
// contrib - chunk base64 encoded body
if ($body_base64 && !$forward) {
$body = chunk_split(base64_encode($body));
}
// forward
if ($forward && $parent) {
$this->imap_reopenFolder($parent);
// receive entire mail (header + body)
$origmail = @imap_fetchheader($this->_mbox, $forward, FT_UID) . @imap_body($this->_mbox, $forward, FT_PEEK | FT_UID);
if (!defined('IMAP_INLINE_FORWARD') || IMAP_INLINE_FORWARD === false) {
// contrib - chunk base64 encoded body
if ($body_base64) {
$body = chunk_split(base64_encode($body));
}
//use original boundary if it's set
示例5: SendMail
function SendMail($rfc822, $forward = false, $reply = false, $parent = false)
{
debugLog("IMAP-SendMail: " . $rfc822 . "for: {$forward} reply: {$reply} parent: {$parent}");
$mobj = new Mail_mimeDecode($rfc822);
$message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $rfc822, 'crlf' => "\n", 'charset' => 'utf-8'));
$toaddr = $ccaddr = $bccaddr = "";
if (isset($message->headers["to"])) {
$toaddr = $this->parseAddr(Mail_RFC822::parseAddressList($message->headers["to"]));
}
if (isset($message->headers["cc"])) {
$ccaddr = $this->parseAddr(Mail_RFC822::parseAddressList($message->headers["cc"]));
}
if (isset($message->headers["bcc"])) {
$bccaddr = $this->parseAddr(Mail_RFC822::parseAddressList($message->headers["bcc"]));
}
// save some headers when forwarding mails (content type & transfer-encoding)
$headers = "";
$forward_h_ct = "";
$forward_h_cte = "";
$use_orgbody = false;
// clean up the transmitted headers
// remove default headers because we are using imap_mail
$changedfrom = false;
foreach ($message->headers as $k => $v) {
if ($k == "subject" || $k == "to" || $k == "cc" || $k == "bcc") {
continue;
}
// save the original type & encoding headers for the body part
if ($forward && $k == "content-type") {
$forward_h_ct = $v;
continue;
}
if ($forward && $k == "content-transfer-encoding") {
$forward_h_cte = $v;
}
// if the message is a multipart message, then we should use the sent body
if (!$forward && $k == "content-type" && preg_match("/multipart/i", $v)) {
$use_orgbody = true;
}
// check if "from"-header is set
if ($k == "from" && !empty($this->_config['IMAP_FORCEFROM'])) {
$changedfrom = true;
$v = $this->_config['IMAP_FORCEFROM'];
$v = str_replace('%u', $this->_username, $v);
$v = str_replace('%d', $this->_domain, $v);
}
// all other headers stay
if ($headers) {
$headers .= "\n";
}
$headers .= ucfirst($k) . ": " . $v;
}
if (!empty($this->_config['IMAP_FORCEFROM']) && !$changedfrom) {
$v = $this->_config['IMAP_FORCEFROM'];
$v = str_replace('%u', $this->_username, $v);
$v = str_replace('%d', $this->_domain, $v);
if ($headers) {
$headers .= "\n";
}
$headers .= 'From: ' . $v;
}
// if this is a multipart message with a boundary, we must use the original body
if ($use_orgbody) {
list(, $body) = $mobj->_splitBodyHeader($rfc822);
} else {
$body = $this->getBody($message);
}
// reply
if (isset($reply) && isset($parent) && $reply && $parent) {
$this->imap_reopenFolder($parent);
$origmail = @imap_body($this->_mbox, $reply, FT_PEEK | FT_UID);
$mobj2 = new Mail_mimeDecode($origmail);
// receive only body
$body .= $this->getBody($mobj2->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $origmail, 'crlf' => "\n", 'charset' => 'utf-8')));
}
// forward
if (isset($forward) && isset($parent) && $forward && $parent) {
$this->imap_reopenFolder($parent);
// receive entire mail (header + body)
$origmail = @imap_fetchheader($this->_mbox, $forward, FT_PREFETCHTEXT | FT_UID) . @imap_body($this->_mbox, $forward, FT_PEEK | FT_UID);
// build a new mime message, forward entire old mail as file
list($aheader, $body) = $this->mail_attach("forwarded_message.eml", strlen($origmail), $origmail, $body, $forward_h_ct, $forward_h_cte);
// add boundary headers
$headers .= "\n" . $aheader;
}
//advanced debugging
//debugLog("IMAP-SendMail: headers: $headers");
//debugLog("IMAP-SendMail: body: $body");
$send = @imap_mail($toaddr, $message->headers["subject"], $body, $headers, $ccaddr, $bccaddr);
// add message to the sent folder
// build complete headers
$cheaders = "To: " . $toaddr . "\n";
$cheaders .= "Subject: " . $message->headers["subject"] . "\n";
$cheaders .= "Cc: " . $ccaddr . "\n";
$cheaders .= $headers;
$asf = false;
if ($this->_sentID) {
$asf = $this->addSentMessage($this->_sentID, $cheaders, $body);
} else {
debugLog("IMAP-SendMail: No Sent mailbox set");
//.........这里部分代码省略.........
示例6: get_raw_header_and_body
function get_raw_header_and_body($msg_uid = false)
{
$msg_uid or $msg_uid = $this->msg_uid;
static $cache;
if ($msg_uid) {
if ($cache[$msg_uid]) {
return $cache[$msg_uid];
}
$header = imap_fetchheader($this->connection, $msg_uid, FT_UID);
$body = imap_body($this->connection, $msg_uid, FT_UID);
$cache[$msg_uid] = array($header, $body);
return $cache[$msg_uid];
} else {
if ($this->msg_text) {
return Mail_mimeDecode::_splitBodyHeader($this->msg_text);
}
}
}