本文整理汇总了PHP中imap_append函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_append函数的具体用法?PHP imap_append怎么用?PHP imap_append使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_append函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: store_email_into_folder
function store_email_into_folder($msg, $folder = 'SentFromDolibarr')
{
global $user, $db;
$mailboxconfig = new Usermailboxconfig($db);
$mailboxconfig->fetch_from_user($user->id);
$user->mailbox_imap_login = $mailboxconfig->mailbox_imap_login;
$user->mailbox_imap_password = $mailboxconfig->mailbox_imap_password;
$user->mailbox_imap_host = $mailboxconfig->mailbox_imap_host;
$user->mailbox_imap_port = $mailboxconfig->mailbox_imap_port;
$user->mailbox_imap_ssl = $mailboxconfig->mailbox_imap_ssl;
$user->mailbox_imap_ssl_novalidate_cert = $mailboxconfig->mailbox_imap_ssl_novalidate_cert;
$user->mailbox_imap_ref = $mailboxconfig->get_ref();
$user->mailbox_imap_connector_url = $mailboxconfig->get_connector_url();
$mbox = imap_open($user->mailbox_imap_connector_url . $folder, $user->mailbox_imap_login, $user->mailbox_imap_password);
$check = imap_check($mbox);
$before = $check->Nmsgs;
$result = imap_append($mbox, $user->mailbox_imap_connector_url . $folder, $msg);
$check = imap_check($mbox);
$after = $check->Nmsgs;
if ($result == FALSE) {
if (imap_createmailbox($mbox, imap_utf7_encode($user->mailbox_imap_ref . $folder))) {
$mbox = imap_open($user->mailbox_imap_connector_url . $folder, $user->mailbox_imap_login, $user->mailbox_imap_password);
$check = imap_check($mbox);
$before = $check->Nmsgs;
$result = imap_append($mbox, $user->mailbox_imap_connector_url . $folder, $msg);
$check = imap_check($mbox);
$after = $check->Nmsgs;
}
}
imap_close($mbox);
}
开发者ID:zenp76,项目名称:dolibarr-webmail-module,代码行数:31,代码来源:lib_dolimail.php
示例2: appendMessage
/**
* Appends a message to a mailbox
* @param string $mailbox The mailbox to append the message to
* @param zibo\library\mail\Message $message The message to append
* @return null
* @throws zibo\library\mail\exception\MailException when th message could not be appended to the mailbox
*/
public function appendMessage($mailbox, Message $message)
{
$parser = new MessageParser($message);
$message = 'Subject: ' . $parser->getSubject() . "\r\n";
$message .= implode("\r\n", $parser->getHeaders());
$message .= "\r\n\r\n" . $parser->getBody();
$connection = $this->getConnection($mailbox);
$stream = $connection->getStream();
$reference = $connection->getReference();
if (!imap_append($stream, $reference, $message)) {
throw new MailException('Could not append the message to ' . $mailbox . ': ' . imap_last_error());
}
}
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:20,代码来源:Client.php
示例3: addmail
/**
* @name: addmail
* Wenn die Mails nicht per imap geholt werden, fuege die Mail mit allen header-Daten aus $xarf als Mail ein.
*
* @param $xarf-report
* @return Boolean
*/
public function addmail($xarf)
{
$config = $this->config;
preg_match('/subject: (.*)/im', $xarf, $subject);
$this->subject = $subject[1];
$xarf = str_replace("\n", "\r\n", $xarf);
$check = imap_check($this->connection);
$add = imap_append($this->connection, '{' . $config['server'] . ':' . $config['port'] . '/' . $config['conntyp'] . '/' . $config['extras'] . '}' . $config['ordner'], stripslashes($xarf));
$check1 = imap_check($this->connection);
if ($check < $check1 && $add == 1) {
$return = 0;
} else {
$return = 1;
}
return $return;
}
开发者ID:aalmenar,项目名称:validatexarf,代码行数:23,代码来源:validator.class.php
示例4: copyToFolder
/**
* Save email to a folder (via IMAP)
*
* This function will open an IMAP stream using the email
* credentials previously specified, and will save the email
* to a specified folder. Parameter is the folder name (ie, Sent)
* if nothing was specified it will be saved in the inbox.
*
* @author David Tkachuk <http://davidrockin.com/>
*/
public function copyToFolder($folderPath = "SendByWebsite")
{
$message = $this->MIMEHeader . $this->MIMEBody;
//$path = "";//"INBOX" . (isset($folderPath) && !is_null($folderPath) ? ".".$folderPath : ""); // Location to save the email
$imapStream = imap_open("{imap.mail.hostpoint.ch:143/notls}SendByWebsite", $this->Username, $this->Password);
/* $arr = imap_getmailboxes($imapStream, "{imap.mail.hostpoint.ch:143}", "*");
Use this to find the Folder to save the sent email to
if (is_array($arr)) {
foreach ($arr as $key => $val) {
echo "($key) ";
echo imap_utf7_decode($val->name) . ",";
echo "'" . $val->delimiter . "',";
echo $val->attributes . "<br />\n";
}
} else {
echo "imap_getmailboxes failed: " . imap_last_error() . "\n";
}
*/
if ($imapStream != false) {
imap_append($imapStream, "{imap.mail.hostpoint.ch:143/notls" . $folderPath . "}", $message);
imap_close($imapStream);
}
}
开发者ID:famoser,项目名称:onepagecreator,代码行数:33,代码来源:mailer.php
示例5: create_multipart_message
/**
* Create a multipart message with subparts
*
* @param resource $imap_stream
* @param string $mailbox
*/
function create_multipart_message($imap_stream, $mailbox)
{
global $users, $domain;
$envelope["from"] = "[email protected]";
$envelope["to"] = "{$users['0']}@{$domain}";
$envelope["subject"] = "Test msg 1";
$part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed";
$part2["type"] = TYPETEXT;
$part2["subtype"] = "plain";
$part2["description"] = "imap_mail_compose() function";
$part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
$part3["type"] = TYPETEXT;
$part3["subtype"] = "plain";
$part3["description"] = "Example";
$part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
$file_handle = fopen(__FILE__, 'r+');
$file_size = 1;
$part4["type"] = TYPEAPPLICATION;
$part4["encoding"] = ENCBASE64;
$part4["subtype"] = "octet-stream";
$part4["description"] = 'Test';
$part4['disposition.type'] = 'attachment';
$part4['disposition'] = array('filename' => 'Test');
$part4['type.parameters'] = array('name' => 'Test');
$part4["contents.data"] = base64_encode(fread($file_handle, 1));
$body[1] = $part1;
$body[2] = $part2;
$body[3] = $part3;
$body[4] = $part4;
$msg = imap_mail_compose($envelope, $body);
if (imap_append($imap_stream, $mailbox, $msg) === false) {
echo imap_last_error() . "\n";
echo "TEST FAILED : could not append new message to mailbox '{$mailbox}'\n";
exit;
}
}
开发者ID:badlamer,项目名称:hhvm,代码行数:43,代码来源:imap_fetch_overview_variation6.php
示例6: addMail
public function addMail($msg, $seen = true)
{
return imap_append($this->getImapStream(), $this->imapPath, $msg . "\r\n", $seen ? "\\Seen" : null);
}
开发者ID:julianstricker,项目名称:XxamMailclientBundle,代码行数:4,代码来源:ImapMailbox.php
示例7: copyToFolder
/**
* Save email to a folder (via IMAP)
*
* This function will open an IMAP stream using the email
* credentials previously specified, and will save the email
* to a specified folder. Parameter is the folder name (ie, Sent)
* if nothing was specified it will be saved in the inbox.
*
* @author David Tkachuk <http://davidrockin.com/>
*/
public function copyToFolder($folderPath = null)
{
$message = $this->MIMEHeader . $this->MIMEBody;
$path = "INBOX" . (isset($folderPath) && !is_null($folderPath) ? "." . $folderPath : "");
// Location to save the email
$imapStream = imap_open("{" . $this->Host . "}" . $path, $this->Username, $this->Password);
imap_append($imapStream, "{" . $this->Host . "}" . $path, $message);
imap_close($imapStream);
}
开发者ID:smileytechguy,项目名称:nLine,代码行数:19,代码来源:class.phpmailer.php
示例8: saveMailToImap
public function saveMailToImap($content, $folder = 'INBOX')
{
imap_append($this->imapStream, $this->getMailbox() . $folder, $content);
}
开发者ID:trejjam,项目名称:emailing,代码行数:4,代码来源:Imap.php
示例9: appendMessage
public function appendMessage($message, $box = 'IMAP.Sent', $flags = null, $messageId = null)
{
$mailbox = $this->imap->reopen($box);
$date = null;
if ($messageId) {
//var_dump($messageId);
$messageId = imap_uid($this->connection, $messageId);
//var_dump($messageId);
$headerinfo = imap_headerinfo($this->connection, $messageId);
$date = date('d-M-Y H:i:s O', $headerinfo->udate);
}
$result = imap_append($this->connection, $mailbox, $message, $flags);
$this->fullName = $this->imap->reopen($this->name);
return $result;
}
开发者ID:veronecrm,项目名称:mod.verone.mail,代码行数:15,代码来源:Mailbox.php
示例10: send
//.........这里部分代码省略.........
}
if (strpos($description, '$logo$')) {
$description = str_replace('$logo$', "<img src='cid:logo' />", $description);
$logo = true;
}
foreach ($emails as $email) {
$mailer->Body = '';
if ($parentModule) {
$mailer->Body = $this->getTrackImageDetails($id, $this->isEmailTrackEnabled());
}
$mailer->Body .= $description;
$mailer->Signature = str_replace(array('\\r\\n', '\\n'), '<br>', $currentUserModel->get('signature'));
if ($mailer->Signature != '') {
$mailer->Body .= '<br><br>' . decode_html($mailer->Signature);
}
$mailer->Subject = $subject;
$mailer->AddAddress($email);
//Adding attachments to mail
if (is_array($attachments)) {
foreach ($attachments as $attachment) {
$fileNameWithPath = $rootDirectory . $attachment['path'] . $attachment['fileid'] . "_" . $attachment['attachment'];
if (is_file($fileNameWithPath)) {
$mailer->AddAttachment($fileNameWithPath, $attachment['attachment']);
}
}
}
if ($logo) {
//While sending email template and which has '$logo$' then it should replace with company logo
$mailer->AddEmbeddedImage(dirname(__FILE__) . '/../../../layouts/vlayout/skins/images/logo_mail.jpg', 'logo', 'logo.jpg', 'base64', 'image/jpg');
}
$ccs = array_filter(explode(',', $this->get('ccmail')));
$bccs = array_filter(explode(',', $this->get('bccmail')));
if (!empty($ccs)) {
// SalesPlatform.ru begin
foreach ($ccs as $cc) {
$mailer->AddCC($idn->encode($cc));
}
//$mailer->AddCC($cc);
// SalesPlatform.ru end
}
if (!empty($bccs)) {
// SalesPlatform.ru begin
foreach ($bccs as $bcc) {
$mailer->AddBCC($idn->encode($bcc));
}
//$mailer->AddBCC($bcc);
// SalesPlatform.ru end
}
}
// SalesPlatform.ru begin
$idn = new idna_convert();
$query = "select * from vtiger_systems where server_type=?";
$params = array('email');
//SalesPlatform begin fix bug
$adb = PearDatabase::getInstance();
//SalesPaltform.ru end
$result = $adb->pquery($query, $params);
$server_username = $adb->query_result($result, 0, 'server_username');
$from_name_db = $adb->query_result($result, 0, 'from_name');
$server_port = $adb->query_result($result, 0, 'server_port');
$server_tls = $adb->query_result($result, 0, 'server_tls');
if ($server_username != '') {
$server_username = $idn->encode($server_username);
$mailer->Username = $server_username;
}
if (isset($from_name_db) && $from_name_db != '') {
$mailer->FromName = decode_html($from_name_db);
}
$from_email = $adb->query_result($result, 0, 'from_email_field');
if ($from_email != '') {
$mailer->From = $idn->encode($from_email);
}
if (!empty($server_port) && $server_port != 0) {
$mailer->Port = $server_port;
}
if (!empty($server_tls) && $server_tls != 'no') {
$mailer->SMTPSecure = $server_tls;
}
$use_sendmail = $adb->query_result($result, 0, 'use_sendmail');
if ($use_sendmail == "on") {
$mailer->IsSendmail();
} else {
$mailer->IsSMTP();
}
// SalesPlatform.ru end
$status = $mailer->Send(true);
if (!$status) {
$status = $mailer->getError();
} else {
$mailString = $mailer->getMailString();
$mailBoxModel = MailManager_Mailbox_Model::activeInstance();
$folderName = $mailBoxModel->folder();
if (!empty($folderName) && !empty($mailString)) {
$connector = MailManager_Connector_Connector::connectorWithModel($mailBoxModel, '');
imap_append($connector->mBox, $connector->mBoxUrl . $folderName, $mailString, "\\Seen");
}
}
}
return $status;
}
开发者ID:Wasage,项目名称:werpa,代码行数:101,代码来源:Record.php
示例11: imap_open
//send the message, check for errors
$result = $mail->send();
if (!$result) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
$host = '{imap.gmail.com:993/imap/ssl}[Gmail]/Sent Mail';
$user = '[email protected]';
$password = 'GDGpass123';
$mbox = imap_open($host, $user, $password);
$count = 0;
if (!$mbox) {
echo "IMAP Error";
} else {
$dmy = date("d-M-Y H:i:s");
$msg = "From: {$event_mail}\r\n" . "To: {$to}\r\n" . "Date: {$dmy}\r\n" . "Subject: {$subject}\r\n" . "Message: {$message}\r\n";
if (imap_append($mbox, $host, $msg)) {
echo "<h3><center>Message sent!</h3></center>";
} else {
echo "<h3><center>Message not sent!</h3></center>";
}
imap_close($mbox);
}
}
} else {
echo "Connection Failed";
}
mysqli_close($mysqli);
} else {
if (isset($_SESSION["ec_name"]) && !isset($_REQUEST["id"])) {
header("Location:ec_home.php");
} else {
开发者ID:shambhavi110,项目名称:Riviera-Mailer,代码行数:31,代码来源:mail.php
示例12: create
//.........这里部分代码省略.........
* Stop searching in all folders
*/
return $data;
}
}
}
}
return array();
case 'message':
require_once ROOTPATH . '/library/uuid/class.uuid.php';
$GLOBALS['phpgw_info']['flags'] = array('noheader' => true, 'nonavbar' => true, 'currentapp' => 'expressoMail', 'enable_nextmatchs_class' => True);
$return = array();
require_once dirname(__FILE__) . '/../../services/class.servicelocator.php';
$mailService = ServiceLocator::getService('mail');
$msg_uid = $data['msg_id'];
$body = $data['body'];
$body = str_replace("<", "&yzwkx;", $body);
//Alterar as Entities padrão das tags < > para compatibilizar com o Expresso
$body = str_replace(">", "&xzwky;", $body);
$body = str_replace("%nbsp;", " ", $body);
$body = html_entity_decode($body, ENT_QUOTES, 'ISO-8859-1');
$body = str_replace("&yzwkx;", "<", $body);
$body = str_replace("&xzwky;", ">", $body);
$folder = mb_convert_encoding($data['folder'], "UTF7-IMAP", "ISO-8859-1, UTF-8");
$folder = @preg_replace('/INBOX[\\/.]/i', "INBOX" . $this->imap_delimiter, $folder);
/**
* Gera e preenche o field Message-Id do header
*/
$mailService->addHeaderField('Message-Id', UUID::generate(UUID::UUID_RANDOM, UUID::FMT_STRING) . '@Draft');
$mailService->addHeaderField('Reply-To', mb_convert_encoding($data['input_reply_to'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
$mailService->addHeaderField('Date', date("d-M-Y H:i:s"));
$mailService->addTo(mb_convert_encoding($data['input_to'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
$mailService->addCc(mb_convert_encoding($data['input_cc'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
$mailService->addBcc(mb_convert_encoding($data['input_cco'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
$mailService->setSubject(mb_convert_encoding($data['input_subject'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
if (isset($data['input_important_message'])) {
$mailService->addHeaderField('Importance', 'High');
}
if (isset($data['input_return_receipt'])) {
$mailService->addHeaderField('Disposition-Notification-To', Config::me('mail'));
}
$this->rfc2397ToEmbeddedAttachment($mailService, $body);
$isHTML = isset($data['type']) && $data['type'] == 'html' ? true : false;
if (!$body) {
$body = ' ';
}
$mbox_stream = $this->open_mbox($folder);
$attachment = json_decode($data['attachments'], TRUE);
if (!empty($attachment)) {
foreach ($attachment as &$value) {
if ((int) $value > 0) {
$att = Controller::read(array('id' => $value, 'concept' => 'mailAttachment'));
if ($att['disposition'] == 'embedded' && $isHTML) {
$body = str_replace('"../prototype/getArchive.php?mailAttachment=' . $att['id'] . '"', '"' . mb_convert_encoding($att['name'], 'ISO-8859-1', 'UTF-8,ISO-8859-1') . '"', $body);
$mailService->addStringImage(base64_decode($att['source']), $att['type'], mb_convert_encoding($att['name'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
} else {
$mailService->addStringAttachment(base64_decode($att['source']), mb_convert_encoding($att['name'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'), $att['type'], 'base64', isset($att['disposition']) ? $att['disposition'] : 'attachment');
}
unset($att);
} else {
$value = json_decode($value, true);
switch ($value['type']) {
case 'imapPart':
$att = $this->getForwardingAttachment($value['folder'], $value['uid'], $value['part']);
if (strstr($body, 'src="./inc/get_archive.php?msgFolder=' . $value['folder'] . '&msgNumber=' . $value['uid'] . '&indexPart=' . $value['part'] . '"') !== false) {
$body = str_ireplace('src="./inc/get_archive.php?msgFolder=' . $value['folder'] . '&msgNumber=' . $value['uid'] . '&indexPart=' . $value['part'] . '"', 'src="' . $att['name'] . '"', $body);
$mailService->addStringImage($att['source'], $att['type'], mb_convert_encoding($att['name'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
} else {
$mailService->addStringAttachment($att['source'], mb_convert_encoding($att['name'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'), $att['type'], 'base64', isset($att['disposition']) ? $att['disposition'] : 'attachment');
}
unset($att);
break;
case 'imapMSG':
$mbox_stream = $this->open_mbox($value['folder']);
$rawmsg = $this->getRawHeader($value['uid']) . "\r\n\r\n" . $this->getRawBody($value['uid']);
$mailService->addStringAttachment($rawmsg, mb_convert_encoding(base64_decode($value['name']), 'ISO-8859-1', 'UTF-8,ISO-8859-1'), 'message/rfc822', '7bit', 'attachment');
unset($rawmsg);
break;
default:
break;
}
}
}
}
if ($isHTML) {
$mailService->setBodyHtml($body);
} else {
$mailService->setBodyText(mb_convert_encoding($body, 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
}
if (imap_append($mbox_stream, "{" . $this->imap_server . ":" . $this->imap_port . "}" . $folder, $mailService->getMessage(), "\\Seen \\Draft")) {
$status = imap_status($mbox_stream, "{" . $this->imap_server . ":" . $this->imap_port . "}" . $folder, SA_UIDNEXT);
$return['id'] = $status->uidnext - 1;
if ($data['uidsSave']) {
$this->delete_msgs(array('folder' => $folder, 'msgs_number' => $data['uidsSave']));
}
Logger::info('expressomail', 'SAVEMSG', 'ID: ' . $return['id'] . ' # ' . 'Subject:' . $data['input_subject']);
}
return $return;
}
}
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:ImapServiceAdapter.php
示例13: importMail
/**
* This method provides the functionality to import MIME messages into the server
* using the {@link imap_append} method.
*
* @param string $dest_mb
* The destination mailbox where the messages will be imported to.
* @param array $messages
* An array of MIME messages to import.
*
* @return BOOL
* @access public
* @see imap_append
* @tutorial http://www.smilingsouls.net/Mail_IMAP?content=Mail_IMAP_ManageMB/importMail
*/
function importMail($dest_mb, $messages)
{
if (is_array($messages)) {
$opt = isset($this->option['append']) ? $this->option['append'] : NULL;
foreach ($messages as $msg) {
if (!@imap_append($this->mailbox, $this->mailboxInfo['host'] . $dest_mb, $msg, $opt)) {
$this->error->push(Mail_IMAPv2_ERROR, 'error', NULL, 'Unable to import message, imap_append failed!');
$ret = FALSE;
}
}
if (!isset($ret)) {
$ret = TRUE;
}
} else {
$this->error->push(Mail_IMAPv2_ERROR_ARGUMENT_REQUIRES_ARRAY, 'error', array('arg' => '$messages'));
$ret = FALSE;
}
return $ret;
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:33,代码来源:ManageMB.php
示例14: sendToServerThroughIMAP
function sendToServerThroughIMAP($server, $with_ssl, $transport, $ssl_port, $box, $from, $password, $content)
{
$password = self::ENCRYPT_DECRYPT($password);
$ssl = $with_ssl == '1' || $transport == 'ssl' ? '/ssl' : '';
$tls = $transport == 'tls' ? '/tls' : '';
$no_valid_cert = $ssl == '' && $tls == '' ? '/novalidate-cert' : '';
$port = $with_ssl == '1' ? ':' . $ssl_port : '';
$mail_box = isset($box) ? $box : 'INBOX.Sent';
$connection = '{' . $server . $port . '/imap' . $no_valid_cert . $ssl . $tls . '}' . $mail_box;
$stream = imap_open($connection, $from, $password);
if ($stream !== FALSE) {
imap_append($stream, $connection, $content);
imap_close($stream);
}
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:15,代码来源:MailUtilities.class.php
示例15: addMessage
/**
* Add a message to the mailbox
*
* @param string $message
*
* @return boolean
*/
public function addMessage($message)
{
return \imap_append($this->connection->getResource(), $this->mailbox, $message);
}
开发者ID:jhonn921007,项目名称:imap,代码行数:11,代码来源:Mailbox.php
示例16: save_to_outbox
public function save_to_outbox()
{
$mbox = @imap_open("{" . $this->imap_config['host'] . ":" . $this->imap_config['port'] . "/imap/ssl}", $this->config['mail_from_mailbox'], $this->config['smtp_password']);
if (!$mbox) {
return 'Невозможно сохранить письмо в исходящих, проверьте настройки imap или соединение с интернетом';
die;
}
$check = imap_check($mbox);
imap_append($mbox, "{" . $this->imap_config['host'] . ":" . $this->imap_config['port'] . "}&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-", $this->letter, "\\Seen");
$check = imap_check($mbox);
imap_close($mbox);
return true;
}
开发者ID:velikiinyashko,项目名称:dle,代码行数:13,代码来源:smtp_class.php
示例17: Create_New_Note
/**
* Create a new note with a given subject and body text.
*
* @param string $Note_Subject The note subject.
* @param string $Note_Text The note body text.
*
* @return boolean <u>Description:</u><br>Returns TRUE if the note was created successfully and FALSE if the creation failed
*/
function Create_New_Note($Note_Subject, $Note_Text)
{
$currenttime = strftime('%a, %d %b %Y %H:%M:%S %z');
$note = "Date: {$currenttime}\nFrom: {$this->email}\nX-Uniform-Type-Identifier: com.apple.mail-note\nContent-Type: text/html;\nSubject: {$Note_Subject}\n\n{$Note_Text}";
return imap_append($this->imap, "{imap.mail.me.com:993/imap/ssl}Notes", $note);
}
开发者ID:aviginsberg,项目名称:iNotePrecipitator,代码行数:14,代码来源:iNotePrecipitator.php
示例18: SmtpSend
//.........这里部分代码省略.........
$pattern = '/^MIME\\-Version:.*\\n/m';
$match = preg_match($pattern, $aux_cifra1, $teste2);
$aux_cifra1 = preg_replace($pattern, $teste1[0] . $teste2[0], $aux_cifra1, 1);
// Adiciona Disposition-Notification-To logo acima de MIME-Version
}
// Fim relocação dos headers
// Vai partir em duas partes a msg. A primeira parte he a dos headers, e a segunda vai ser criptografada ...
$pos_content_type = strpos($aux_cifra1, 'Content-Type:');
$pos_MIME_Version = strpos($aux_cifra1, 'MIME-Version: 1.0' . chr(0xd) . chr(0xa));
$valx_len = 19;
if ($pos_MIME_Version === False) {
$pos_MIME_Version = strpos($aux_cifra1, 'MIME-Version: 1.0' . chr(0xa));
$valx_len = 18;
}
if ($pos_MIME_Version >= $pos_content_type) {
// nao deve enviar a msg..... O header MIME-Version com posicao invalida ......
$this->SetError('Formato dos headers da msg estao invalidos.(CD-17) - A');
$this->smtp->Reset();
return false;
}
$aux_cifra2 = array();
$aux_cifra2[] = substr($aux_cifra1, 0, $pos_MIME_Version - 1);
$aux_cifra2[] = substr($aux_cifra1, $pos_MIME_Version + $valx_len);
/*
// este explode pode ser fonte de problemas .......
$aux_cifra2 = explode('MIME-Version: 1.0' . chr(0x0A), $aux_cifra1);
// Pode ocorrer um erro se nao tiver o header MIME-Version .....
if(count($aux_cifra2) != 2 )
{
$aux_cifra2 = explode('MIME-Version: 1.0' . chr(0x0D) . chr(0x0A), $aux_cifra1);
if(count($aux_cifra2) != 2 )
{
// nao deve enviar a msg..... nao tem o header MIME-Version ......
$this->SetError('Formato dos headers da msg estao invalidos.(CD-17) - ' . count($aux_cifra2));
$this->smtp->Reset();
return false;
}
}
*/
$certificado = new certificadoB();
$h = array();
$aux_body = $certificado->encriptar($aux_cifra2[1], $this->Certs_crypt, $h);
if (!$aux_body) {
$this->SetError('Ocorreu um erro. A msg nao foi enviada. (CD-18)');
$this->smtp->Reset();
return false;
}
// salvar sem cifra......
//$smtpSent = $this->smtp->Data($aux_cifra2[0] . $aux_body);
// salva a msg sifrada. neste caso deve ter sido adicionado o certificado do autor da msg......
$header = $aux_cifra2[0];
$body = $aux_body;
$smtpSent = $this->smtp->Data($header . $body);
} else {
$smtpSent = $this->smtp->Data($header . $body);
}
if (!$smtpSent) {
$this->SetError($this->Lang("data_not_accepted") . ' ' . $this->smtp->error['error'] . ',' . $this->smtp->error['smtp_code'] . ',' . $this->smtp->error['smtp_msg']);
$this->smtp->Reset();
return false;
}
if ($this->SMTPKeepAlive == true) {
$this->smtp->Reset();
} else {
$this->SmtpClose();
}
if ($this->SaveMessageInFolder) {
$username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
$password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
$imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
$imap_port = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') {
$imap_options = '/tls/novalidate-cert';
} else {
$imap_options = '/notls/novalidate-cert';
}
$mbox_stream = imap_open("{" . $imap_server . ":" . $imap_port . $imap_options . "}" . $this->SaveMessageInFolder, $username, $password);
##
# @AUTHOR Rodrigo Souza dos Santos
# @DATE 2008/09/11
# @BRIEF Adding arbitrarily the BCC field. You may need to
# check if this field already exists in the header.
##
if (count($this->bcc) > 0) {
$target = stripos($header, 'subject');
$header = substr($header, 0, $target) . $this->AddrAppend("Bcc", $this->bcc) . substr($header, $target);
}
$new_headerx = str_replace(chr(0xa), chr(0xd) . chr(0xa), $header);
$new_bodyx = str_replace(chr(0xa), chr(0xd) . chr(0xa), $body);
$new_header = str_replace(chr(0xd) . chr(0xd) . chr(0xa), chr(0xd) . chr(0xa), $new_headerx);
$new_body = str_replace(chr(0xd) . chr(0xd) . chr(0xa), chr(0xd) . chr(0xa), $new_bodyx);
if ($this->SaveMessageAsDraft) {
imap_append($mbox_stream, "{" . $imap_server . ":" . $imap_port . "}" . $this->SaveMessageInFolder, $new_header . $new_body, "\\Seen \\Draft");
return true;
} else {
imap_append($mbox_stream, "{" . $imap_server . ":" . $imap_port . "}" . $this->SaveMessageInFolder, $new_header . $new_body, "\\Seen");
}
}
return $smtpSent;
}
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:class.phpmailer.php
示例19: imap_header
for ($i = 1; $i <= $da_no_msgs; $i++) {
$obj = imap_header($src_mbox, $i);
$msg_date = $obj->udate;
$msg_date = getSentDate($src_mbox, $i);
if (false) {
print "msg_date = {$msg_date}\n";
$con = date("D, d M Y H:i:s", $msg_date);
print "convert date back = {$con}\n";
exit;
}
if ($archive_date == -1 || $msg_date < $archive_date) {
$contents = imap_fetchheader($src_mbox, $i) . "\r\n" . imap_body($src_mbox, $i, FT_PEEK);
if ($debug) {
print "\nappending msg {$i}: {$dest_server} {$dest_mbox} : {$msg_date} < {$archive_date}\n";
}
if (imap_append($dest_mbox, $dst_imap_string . $dest_mailbox, $contents)) {
setDestFlagsToSrcFlags($dest_mbox, $src_mbox, $i);
if ($delete_src_msg == "true") {
if ($debug) {
print "delete_src_msg = {$delete_src_msg} - Deleting source message\n";
}
if (!deletemsg($src_mbox, $i)) {
print " WARNING message {$i} for {$src_username} on {$src_server} not deleted!!\n";
}
} else {
if ($debug) {
print "delete_src_msg = {$delete_src_msg} - NOT deleting source message\n";
}
}
} else {
print " WARNING message {$i} for {$src_username} on {$src_server} not appended to {$dest_server}\n";
开发者ID:Jensen-Technologies,项目名称:imap-importing,代码行数:31,代码来源:archive.php
示例20: insert_email
function insert_email($source, $folder, $timestamp, $flags)
{
$username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
$password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
$imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
$imap_port = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
$imap_options = '/notls/novalidate-cert';
$folder = mb_convert_encoding($folder, "UTF7-IMAP", "ISO-8859-1");
$mbox_stream = imap_open("{" . $imap_server . ":" . $imap_port . $imap_options . "}" . $folder, $username, $password);
if (imap_last_error() === 'Mailbox already exists') {
imap_createmailbox($mbox_stream, imap_utf7_encode("{" . $imap_server . "}" . $folder));
}
if ($timestamp) {
if (version_compare(PHP_VERSION, '5.3.2', '>=')) {
$return['append'] = imap_append($mbox_stream, "{" . $imap_server . ":" . $imap_port . "}" . mb_convert_encoding($folder, "UTF7-IMAP", "ISO_8859-1"), $source, '', date('d-M-Y H:i:s O', $timestamp));
} else {
$pdate = date_parse(date('r'));
// pega a data atual do servidor (TODO: pegar a data da mensagem local)
$timestamp += $pdate['zone'] * 60;
//converte a data da mensagem para o fuso horário GMT 0. Isto é feito devido ao Expresso Mail armazenar a data no fuso horário GMT 0 e para exibi-la converte ela para o fuso horário local.
/* TODO: o diretorio /tmp deve ser substituido pelo diretorio temporario configurado no setup */
$file = "/tmp/sess_" . $_SESSION['phpgw_session']['session_id'];
$f = fopen($file, "w");
fputs($f, base64_encode($source));
fclose($f);
$command = "python " . dirname(__FILE__) . "/../imap.py \"{$imap_server}\" \"{$imap_port}\" \"{$username}\" \"{$password}\" \"{$timestamp}\" \"{$folder}\" \"{$file}\"";
$return['command'] = exec($command);
}
} else {
$return['append'] = imap_append($mbox_stream, "{" . $imap_server . ":" . $imap_port . "}" . $folder, $source, "\\Seen");
}
if (!empty($return['command'])) {
list($result, $msg) = explode(':', $return['command']);
if (strtoupper($result) === 'NO') {
$return['error'] = $msg;
return $return;
}
}
$status = imap_status($mbox_stream, "{" . $this->imap_server . ":" . $this->imap_port . "}" . $folder, SA_UIDNEXT);
$return['msg_no'] = $status->uidnext - 1;
$return['error'] = '';
if (imap_last_error() && imap_last_error() != "SECURITY PROBLEM: insecure server advertised AUTH=PLAIN") {
$return['error'] = imap_last_error();
}
if (!$return['error'] && $flags != '') {
$flags_array = explode(':', $flags);
//"Answered","Draft","Flagged","Unseen"
$flags_fixed = "";
if ($flags_array[0] == 'A') {
$flags_fixed .= "\\Answered ";
}
if ($flags_array[1] == 'X') {
$flags_fixed .= &q
|
请发表评论