本文整理汇总了PHP中Mail_mime::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail_mime::getMessage方法的具体用法?PHP Mail_mime::getMessage怎么用?PHP Mail_mime::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail_mime
的用法示例。
在下文中一共展示了Mail_mime::getMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wifidog_register_perform
//.........这里部分代码省略.........
}
if ($ENABLED_SMTP == 0) {
$autocreate_confirmed = 1;
}
if ($GLOBALS["HOTSPOT_DEBUG"]) {
wifidog_logs("Create new member {$email},{$password},TTL:{$ArticaSplashHotSpotEndTime}", __FUNCTION__, __LINE__);
}
$sql = "INSERT IGNORE INTO hotspot_members \n\t(uid,username,token,ruleid,ttl,sessiontime,password,enabled,creationtime,autocreate,autocreate_confirmed,autocreate_maxttl,sessionkey,MAC) VALUES\n\t('{$email}','{$email}','{$token}','{$_SESSION["WIFIDOG_RULES"]}','{$ArticaSplashHotSpotEndTime}','','{$password}',1,'{$creationtime}',1,'{$autocreate_confirmed}',{$autocreate_maxttl},'{$sessionkey}','{$MAC}')";
$q->QUERY_SQL($sql);
wifidog_logs("[{$ARP}]:[{$GLOBALS["CONNECTED_IP"]}]: {$email}: Create New member with a token {$token}", __FUNCTION__, __LINE__);
if (!$q->ok) {
events(0, "MySQL error: {$q->mysql_error} (Line: " . __LINE__ . ")");
wifidog_logs("{$q->mysql_error}");
wifidog_logs("{$sql}");
return wifidog_register($q->mysql_error);
}
if ($ENABLED_SMTP == 0) {
$array["SERVER_NAME"] = $_SERVER["SERVER_NAME"];
$array["redirecturi"] = $url;
$array["LOGIN"] = $email;
$array["redirecturi"] = $_REQUEST["url"];
$array["REMOTE_ADDR"] = $_REQUEST["ip"];
$array["token"] = $token;
$array["HOST"] = $_REQUEST["ip"];
$array["ruleid"] = $_SESSION["WIFIDOG_RULES"];
UnLock($array);
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: SESSION(HOTSPOT_REDIRECT_URL) = {$url}");
$_SESSION["HOTSPOT_AUTO_REGISTER"] = true;
$_SESSION["HOTSPOT_REDIRECT_URL"] = $url;
$redirecturi = "http://{$gateway_addr}:{$gw_port}/wifidog/auth?token={$token}";
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: Redirect Token: {$token} to {$redirecturi}");
header("Location: {$redirecturi}");
return;
}
$proto = "http";
$myHostname = $_SERVER["HTTP_HOST"];
$page = CurrentPageName();
if (isset($_SERVER["HTTPS"])) {
$proto = "https";
}
$URL_REDIRECT = "{$proto}://{$myHostname}/{$page}?wifidog-confirm={$sessionkey}";
$smtp_sender = $sock->GET_INFO("smtp_sender");
include_once dirname(__FILE__) . "/ressources/externals/mime/mime.inc";
$message = new Mail_mime("\r\n");
$text = "<p style=font-size:18px>{$wifidog_templates->REGISTER_MESSAGE}</p>\n\t<p>\t\n\t<hr>\n\t\t<center>\n\t\t\t<a href=\"{$URL_REDIRECT}\" style='font-size:22px;text-decoration:underline'>{$URL_REDIRECT}</a>\n\t\t</center>\n\t</p>";
$message->setFrom($smtp_sender);
$message->addTo($email);
$message->setSubject($wifidog_templates->REGISTER_SUBJECT);
$message->setTXTBody(strip_tags($text));
$message->setHTMLBody($text);
$finalbody = $message->getMessage();
$webauth_msmtp = new webauth_msmtp($smtp_sender, $finalbody, $email);
if (!$webauth_msmtp->Send()) {
events(0, "SMTP Error[method 1]: {$webauth_msmtp->logs}", $webauth_msmtp->logs);
$content[] = "Method 1:\n{$webauth_msmtp->logs}\n";
$smtp = new smtp();
if ($sock->GET_INFO("smtp_auth_user") != null) {
$params["auth"] = true;
$params["user"] = $sock->GET_INFO("smtp_auth_user");
$params["pass"] = $sock->GET_INFO("smtp_auth_passwd");
}
$params["host"] = $sock->GET_INFO("smtp_server_name");
$params["port"] = $sock->GET_INFO("smtp_server_port");
if (!$smtp->connect($params)) {
$content[] = "Method2 Error:{$smtp->error_number} {$smtp->error_text}";
events(0, "SMTP Error[method 2 - Connect]: {$params["host"]} {$smtp->error_number} {$smtp->error_text}", @implode("\n", $content));
return wifidog_register("{$email}: {error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}");
}
if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $email, "body" => $finalbody, "headers" => null))) {
events(0, "SMTP Error[method 2 - Send]: {$smtp->error_number} {$smtp->error_text}", null);
$smtp->quit();
return wifidog_register("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}");
}
if ($GLOBALS["HOTSPOT_DEBUG"]) {
wifidog_logs("From: {$smtp_sender} to {$email} {$wifidog_templates->REGISTER_SUBJECT} success");
}
$smtp->quit();
}
if ($GLOBALS["HOTSPOT_DEBUG"]) {
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: Token: {$token} -> UnLock(..");
}
$array["LOGIN"] = $email;
$array["ARP"] = $_REQUEST["mac"];
$array["token"] = $token;
$array["redirecturi"] = $_REQUEST["url"];
$array["REMOTE_ADDR"] = $_REQUEST["ip"];
$array["REGISTER"] = true;
if (!UnLock($array)) {
if ($GLOBALS["HOTSPOT_DEBUG"]) {
wifidog_logs("wifidog_auth/" . __FUNCTION__ . "::failed_to_create_session");
}
return wifidog_register("{error} {failed_to_create_session}");
}
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: SESSION(HOTSPOT_REDIRECT_URL) = {$url}");
$_SESSION["HOTSPOT_AUTO_REGISTER"] = true;
$_SESSION["HOTSPOT_REDIRECT_URL"] = $url;
$redirecturi = "http://{$gateway_addr}:{$gw_port}/wifidog/auth?token={$token}";
wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: Redirect Token: {$token} to {$redirecturi}");
header("Location: {$redirecturi}");
}
示例2:
try {
if (isset($_SESSION['access_token']) && $client->getAccessToken()) {
// Make API Calls
if (isset($_POST['send'])) {
$to = $_POST['to'];
$bcc = $_POST['bcc'];
$cc = $_POST['cc'];
$body = $_POST['message'];
$subject = $_POST['subject'];
$mime->addTo($to);
$mime->addBcc($bcc);
$mime->addCc($cc);
$mime->setTXTBody($body);
$mime->setHTMLBody($body);
$mime->setSubject($subject);
$message_body = $mime->getMessage();
$encoded_message = base64url_encode($message_body);
// Gmail Message Body
$message = new Google_Service_Gmail_Message();
$message->setRaw($encoded_message);
// Send the Email
$email = $service->users_messages->send('me', $message);
if ($email->getId()) {
$notice = '<div class="alert alert-success">Email Sent successfully!</div>';
} else {
$notice = '<div class="alert alert-danger">Oops...something went wrong, try again later</div>';
}
} else {
if (isset($_POST['draft'])) {
$to = $_POST['to'];
$bcc = $_POST['bcc'];
示例3: as_text
//.........这里部分代码省略.........
$action['subject'] .= " \${subject}";
}
$actions .= RCUBE_SIEVE_INDENT . "vacation" . RCUBE_SIEVE_NEWLINE;
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":days " . $action['days'] . RCUBE_SIEVE_NEWLINE;
if (!empty($action['addresses'])) {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":addresses [\"" . str_replace(",", "\",\"", $this->_escape_string($action['addresses'])) . "\"]" . RCUBE_SIEVE_NEWLINE;
}
if (!empty($action['subject'])) {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":subject \"" . $action['subject'] . "\"" . RCUBE_SIEVE_NEWLINE;
}
if (!empty($action['handle'])) {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":handle \"" . $this->_escape_string($action['handle']) . "\"" . RCUBE_SIEVE_NEWLINE;
}
if (!empty($action['from'])) {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":from \"" . $this->_escape_string($action['from']) . "\"" . RCUBE_SIEVE_NEWLINE;
}
if ($action['htmlmsg']) {
$MAIL_MIME = new Mail_mime("\r\n");
$action['msg'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' . "\r\n<html><body>\r\n" . $action['msg'] . "\r\n</body></html>\r\n";
$MAIL_MIME->setHTMLBody($action['msg']);
// add a plain text version of the e-mail as an alternative part.
$h2t = new html2text($action['msg'], false, true, 0);
$plainTextPart = $h2t->get_text();
if (!$plainTextPart) {
// empty message body breaks attachment handling in drafts
$plainTextPart = "\r\n";
} else {
// make sure all line endings are CRLF (#1486712)
$plainTextPart = preg_replace('/\\r?\\n/', "\r\n", $plainTextPart);
}
$MAIL_MIME->setTXTBody($plainTextPart);
$MAIL_MIME->setParam('html_charset', $action['charset']);
$MAIL_MIME->setParam('text_charset', $action['charset']);
$action['msg'] = $MAIL_MIME->getMessage();
}
// escape lines which start is a .
$action['msg'] = preg_replace('/(^|\\r?\\n)\\./', "\$1..", $action['msg']);
if ($action['htmlmsg']) {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":mime text:" . RCUBE_SIEVE_NEWLINE . $action['msg'] . RCUBE_SIEVE_NEWLINE . "." . RCUBE_SIEVE_NEWLINE . ";" . RCUBE_SIEVE_NEWLINE;
} elseif ($action['charset'] != "UTF-8") {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":mime text:" . RCUBE_SIEVE_NEWLINE . "Content-Type: text/plain; charset=" . $action['charset'] . RCUBE_SIEVE_NEWLINE . RCUBE_SIEVE_NEWLINE . $action['msg'] . RCUBE_SIEVE_NEWLINE . "." . RCUBE_SIEVE_NEWLINE . ";" . RCUBE_SIEVE_NEWLINE;
} elseif (strpos($action['msg'], "\n") !== false) {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . "text:" . RCUBE_SIEVE_NEWLINE . $action['msg'] . RCUBE_SIEVE_NEWLINE . "." . RCUBE_SIEVE_NEWLINE . ";" . RCUBE_SIEVE_NEWLINE;
} else {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . "\"" . $this->_escape_string($action['msg']) . "\";" . RCUBE_SIEVE_NEWLINE;
}
break;
case 'imapflags':
case 'imap4flags':
array_push($exts, $action['type']);
if (strpos($actions, "setflag") !== false) {
$actions .= RCUBE_SIEVE_INDENT . "addflag \"" . $this->_escape_string($action['target']) . "\";" . RCUBE_SIEVE_NEWLINE;
} else {
$actions .= RCUBE_SIEVE_INDENT . "setflag \"" . $this->_escape_string($action['target']) . "\";" . RCUBE_SIEVE_NEWLINE;
}
break;
case 'notify':
array_push($exts, 'notify');
$actions .= RCUBE_SIEVE_INDENT . "notify" . RCUBE_SIEVE_NEWLINE;
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":method \"" . $this->_escape_string($action['method']) . "\"" . RCUBE_SIEVE_NEWLINE;
if (!empty($action['options'])) {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":options [\"" . str_replace(",", "\",\"", $this->_escape_string($action['options'])) . "\"]" . RCUBE_SIEVE_NEWLINE;
}
if (!empty($action['from'])) {
$actions .= RCUBE_SIEVE_INDENT . RCUBE_SIEVE_INDENT . ":from \"" . $this->_escape_string($action['from']) . "\"" . RCUBE_SIEVE_NEWLINE;
}
示例4: tests_smtp
function tests_smtp()
{
//ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);
include_once dirname(__FILE__) . "/ressources/externals/mime/mime.inc";
header("content-type: application/x-javascript");
$sock = new sockets();
$sock = new wifidog_settings($_GET["ruleid"]);
$wifidog_templates = new wifidog_templates($_GET["ruleid"]);
$ArticaSplashHotSpotEndTime = $sock->GET_INFO("ArticaSplashHotSpotEndTime");
$proto = "http";
$myHostname = $_SERVER["HTTP_HOST"];
$page = CurrentPageName();
if (isset($_SERVER["HTTPS"])) {
$proto = "https";
}
$URL_REDIRECT = "{$proto}://{$myHostname}/{$page}?wifidog-confirm=NONE";
$tpl = new templates();
$smtp_sender = $sock->GET_INFO("smtp_sender");
if ($GLOBALS["VERBOSE"]) {
echo "new Mail_mime....<br>\n";
}
include_once dirname(__FILE__) . "/ressources/externals/mime/mime.inc";
$message = new Mail_mime("\r\n");
$text = "<p style=font-size:18px>{$wifidog_templates->REGISTER_MESSAGE}</p><p>\n\t<hr><center><a href=\"{$URL_REDIRECT}\" style='font-size:22px;text-decoration:underline'>{$URL_REDIRECT}</a></center></p>";
$message->setFrom($smtp_sender);
$message->addTo($smtp_sender);
$message->setSubject($wifidog_templates->REGISTER_SUBJECT);
$message->setTXTBody(strip_tags($text));
// for plain-text
$message->setHTMLBody($text);
$finalbody = $message->getMessage();
if ($GLOBALS["VERBOSE"]) {
echo $finalbody . "<hr>\n";
}
$webauth_msmtp = new webauth_msmtp($smtp_sender, $finalbody, $smtp_sender, $_GET["ruleid"]);
if ($webauth_msmtp->Send()) {
echo "alert('Rule: {$_GET["ruleid"]} {$smtp_sender} " . $tpl->javascript_parse_text("{$wifidog_templates->REGISTER_SUBJECT}\nTo {$smtp_sender}: {success}") . "');";
return;
} else {
echo "alert('Rule: {$_GET["ruleid"]} {$smtp_sender} Method 1 " . $tpl->javascript_parse_text($webauth_msmtp->logs) . "');";
}
$smtp = new smtp();
if ($sock->GET_INFO("smtp_auth_user") != null) {
$params["auth"] = true;
$params["user"] = $sock->GET_INFO("smtp_auth_user");
$params["pass"] = $sock->GET_INFO("smtp_auth_passwd");
}
$params["host"] = $sock->GET_INFO("smtp_server_name");
$params["port"] = $sock->GET_INFO("smtp_server_port");
if (!$smtp->connect($params)) {
echo "alert('" . $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}") . "');";
return;
}
if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $smtp_sender, "body" => $finalbody, "headers" => null))) {
$smtp->quit();
echo "alert('" . $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}") . "');";
return;
}
echo "alert('" . $tpl->javascript_parse_text("{$wifidog_templates->REGISTER_SUBJECT}\nTo {$smtp_sender}: {success}") . "');";
$smtp->quit();
}
示例5: unset
/**
* Remove attachments from a message
*/
function remove_attachments()
{
$rcmail = rcmail::get_instance();
$imap = $rcmail->storage;
$MESSAGE = new rcube_message(get_input_value('_uid', RCUBE_INPUT_GET));
$headers = $this->_parse_headers($imap->get_raw_headers($MESSAGE->uid));
// set message charset as default
if (!empty($MESSAGE->headers->charset)) {
$imap->set_charset($MESSAGE->headers->charset);
}
// Remove old MIME headers
unset($headers['MIME-Version']);
unset($headers['Content-Type']);
$MAIL_MIME = new Mail_mime($rcmail->config->header_delimiter());
$MAIL_MIME->headers($headers);
if ($MESSAGE->has_html_part()) {
$body = $MESSAGE->first_html_part();
$MAIL_MIME->setHTMLBody($body);
}
$body = $MESSAGE->first_text_part();
$MAIL_MIME->setTXTBody($body, false, true);
foreach ($MESSAGE->attachments as $attachment) {
if ($attachment->mime_id != get_input_value('_part', RCUBE_INPUT_GET) && get_input_value('_part', RCUBE_INPUT_GET) != '-1') {
$MAIL_MIME->addAttachment($MESSAGE->get_part_content($attachment->mime_id), $attachment->mimetype, $attachment->filename, false, $attachment->encoding, $attachment->disposition, '', $attachment->charset);
}
}
foreach ($MESSAGE->mime_parts as $attachment) {
if (!empty($attachment->content_id)) {
// covert CID to Mail_MIME format
$attachment->content_id = str_replace('<', '', $attachment->content_id);
$attachment->content_id = str_replace('>', '', $attachment->content_id);
if (empty($attachment->filename)) {
$attachment->filename = $attachment->content_id;
}
$MESSAGE_body = $MAIL_MIME->getHTMLBody();
$dispurl = 'cid:' . $attachment->content_id;
$MESSAGE_body = str_replace($dispurl, $attachment->filename, $MESSAGE_body);
$MAIL_MIME->setHTMLBody($MESSAGE_body);
$MAIL_MIME->addHTMLImage($MESSAGE->get_part_content($attachment->mime_id), $attachment->mimetype, $attachment->filename, false);
}
}
// encoding settings for mail composing
$MAIL_MIME->setParam('head_encoding', $MESSAGE->headers->encoding);
$MAIL_MIME->setParam('head_charset', $MESSAGE->headers->charset);
foreach ($MESSAGE->mime_parts as $mime_id => $part) {
$mimetype = strtolower($part->ctype_primary . '/' . $part->ctype_secondary);
if ($mimetype == 'text/html') {
$MAIL_MIME->setParam('text_encoding', $part->encoding);
$MAIL_MIME->setParam('html_charset', $part->charset);
} else {
if ($mimetype == 'text/plain') {
$MAIL_MIME->setParam('html_encoding', $part->encoding);
$MAIL_MIME->setParam('text_charset', $part->charset);
}
}
}
$saved = $imap->save_message($_SESSION['mbox'], $MAIL_MIME->getMessage());
//write_log("debug","saved=".$saved);
if ($saved) {
$imap->delete_message($MESSAGE->uid);
// Assume the one we just added has the highest UID
//dsoares $uids = $imap->conn->fetchUIDs($imap->mod_mailbox($_SESSION['mbox']));
//dsoares $uid = end($uids);
$uid = $saved;
//dsoares
// set flags
foreach ($MESSAGE->headers->flags as $flag) {
$imap->set_flag($uid, strtoupper($flag), $_SESSION['mbox']);
}
$this->api->output->command('display_message', $this->gettext('attachmentremoved'), 'confirmation');
$this->api->output->command('removeattachments_reload', $uid);
} else {
$this->api->output->command('display_message', $this->gettext('removefailed'), 'error');
}
$this->api->output->send();
}
开发者ID:messagerie-melanie2,项目名称:Roundcube-Plugin-Remove-Attachments,代码行数:79,代码来源:removeattachments.php