本文整理匯總了PHP中mb_encode_mimeheader函數的典型用法代碼示例。如果您正苦於以下問題:PHP mb_encode_mimeheader函數的具體用法?PHP mb_encode_mimeheader怎麽用?PHP mb_encode_mimeheader使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了mb_encode_mimeheader函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: send_recover_mail
function send_recover_mail($user)
{
global $site_key, $globals;
if (!check_email($user->email)) {
return false;
}
$now = time();
if (!empty($globals['email_domain'])) {
$domain = $globals['email_domain'];
} else {
$domain = get_server_name();
}
$key = md5($user->id . $user->pass . $now . $site_key . get_server_name());
$url = $globals['base_url'] . 'profile?login=' . $user->username . '&t=' . $now . '&k=' . $key;
//echo "$user->username, $user->email, $url<br />";
$to = $user->email;
$subject = _('Recuperación o verificación de contraseña de ') . get_server_name();
$subject = mb_encode_mimeheader($subject, "UTF-8", "B", "\n");
$message = $to . ': ' . _('para poder acceder sin la clave, conéctate a la siguiente dirección en menos de 15 minutos:') . "\n\n{$url}\n\n";
$message .= _('Pasado este tiempo puedes volver a solicitar acceso en: ') . "\nhttp://" . get_server_name() . $globals['base_url'] . "login?op=recover\n\n";
$message .= _('Una vez en tu perfil, puedes cambiar la clave de acceso.') . "\n" . "\n";
$message .= "\n\n" . _('Este mensaje ha sido enviado a solicitud de la dirección: ') . $globals['user_ip'] . "\n\n";
$message .= "-- \n " . _('el equipo de menéame');
$message = wordwrap($message, 70);
$headers = 'Content-Type: text/plain; charset="utf-8"' . "\n" . 'From: ' . _('Avisos') . ' ' . $domain . ' <' . _('no_contestar') . "@{$domain}>\n" . 'Reply-To: ' . _('no_contestar') . "@{$domain}\n" . 'X-Mailer: meneame.net' . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
//$pars = '-fweb@'.get_server_name();
mail($to, $subject, $message, $headers);
echo '<p><strong>' . _('Correo enviado, mira tu buzón, allí están las instrucciones. Mira también en la carpeta de spam.') . '</strong></p>';
return true;
}
示例2: envoi
static function envoi($destinataire, $objet, $content)
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: no-reply@' . $_SERVER["HTTP_HOST"] . '' . "\r\n";
return mail($destinataire, mb_encode_mimeheader($objet, "UTF-8"), $content, $headers);
}
示例3: testSendData
/**
* testSend method
*
* @return void
*/
public function testSendData()
{
$email = $this->getMock('CakeEmail', array('message'), array());
$email->from('noreply@cakephp.org', 'CakePHP Test');
$email->returnPath('pleasereply@cakephp.org', 'CakePHP Return');
$email->to('cake@cakephp.org', 'CakePHP');
$email->cc(array('mark@cakephp.org' => 'Mark Story', 'juan@cakephp.org' => 'Juan Basso'));
$email->bcc('phpnut@cakephp.org');
$email->messageID('<4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>');
$longNonAscii = 'Foø Bår Béz Foø Bår Béz Foø Bår Béz Foø Bår Béz';
$email->subject($longNonAscii);
$date = date(DATE_RFC2822);
$email->setHeaders(array('X-Mailer' => 'CakePHP Email', 'Date' => $date, 'X-add' => mb_encode_mimeheader($longNonAscii, 'utf8', 'B')));
$email->expects($this->any())->method('message')->will($this->returnValue(array('First Line', 'Second Line', '.Third Line', '')));
$encoded = '=?UTF-8?B?Rm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXog?=';
$encoded .= ' =?UTF-8?B?Rm/DuCBCw6VyIELDqXo=?=';
$data = "From: CakePHP Test <noreply@cakephp.org>" . PHP_EOL;
$data .= "Return-Path: CakePHP Return <pleasereply@cakephp.org>" . PHP_EOL;
$data .= "Cc: Mark Story <mark@cakephp.org>, Juan Basso <juan@cakephp.org>" . PHP_EOL;
$data .= "Bcc: phpnut@cakephp.org" . PHP_EOL;
$data .= "X-Mailer: CakePHP Email" . PHP_EOL;
$data .= "Date: " . $date . PHP_EOL;
$data .= "X-add: " . $encoded . PHP_EOL;
$data .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>" . PHP_EOL;
$data .= "MIME-Version: 1.0" . PHP_EOL;
$data .= "Content-Type: text/plain; charset=UTF-8" . PHP_EOL;
$data .= "Content-Transfer-Encoding: 8bit";
$this->MailTransport->expects($this->once())->method('_mail')->with('CakePHP <cake@cakephp.org>', $encoded, implode(PHP_EOL, array('First Line', 'Second Line', '.Third Line', '')), $data, '-f');
$this->MailTransport->send($email);
}
示例4: mail_to
public static function mail_to($value, $mails)
{
//return md5($value);
mb_language("japanese");
mb_internal_encoding("utf-8");
$email = mb_encode_mimeheader("チラシシステム") . "<zuo@it-art.jp>";
$subject = $value["title"];
$body = $value["text"];
//$from = "lightbox@sdc";
//ini_set( "SMTP", "localhost" );
//ini_set( "smtp_port", 25 );
//ini_set( "sendmail_from", $from );
$bccs = implode(' ,', $mails);
$header = "From: " . mb_encode_mimeheader("チラシシステム") . "<zuo@it-art.jp>";
$header .= "\n";
$header = "Bcc:" . $bccs;
//$header ="Bcc:zuo@it-art.jp,zou@shift-jp.net";
$header .= "\n";
if (!@mb_send_mail(NULL, $subject, $body, $header)) {
// echo "*********mb_send_mailエラー**************";
return false;
} else {
//echo "*********sucess**************";
return true;
}
}
示例5: enviar
function enviar($params = array())
{
$ok = false;
$email = $params['email'];
if (strlen($email) == 0) {
$email = 'ArthurLehdermann@gmail.com';
}
$contato = $_POST['contato'];
if (strlen($contato['nome']) > 0 && strlen($contato['email']) > 0) {
$this->load->library('MY_PHPMailer');
$mail = new MY_PHPMailer();
$mail->SetFrom($contato['email'], mb_encode_mimeheader($contato['nome']));
$mail->AddAddress($email, mb_encode_mimeheader('Serigrafai El Shaddai'));
$assunto = mb_encode_mimeheader('[Imobiliária Reichert] Contato através do site');
$mensagem = 'Olá,<br>';
$mensagem .= $contato['nome'] . ' entrou em contato pelo site:<br>';
$mensagem .= '<br>';
$mensagem .= 'Nome: ' . $contato['nome'];
$mensagem .= '<br>';
$mensagem .= 'E-mail: ' . $contato['email'];
$mensagem .= '<br>';
$mensagem .= 'Telefone: ' . $contato['telefone'];
$mensagem .= '<br>';
$mensagem .= 'Mensagem: ' . $contato['mensagem'];
$mensagem .= '<br>';
$mail->MsgHTML(str_replace("\n", '<br />', $mensagem));
$ok = $mail->Send();
}
if ($ok) {
redirect(base_url('fale-conosco/sucesso'));
} else {
redirect(base_url('fale-conosco/falha'));
}
}
示例6: send
function send($to, $subject, $body, $msgKey = null)
{
if ($this->smtp_allowed == true && $this->canSendMsg($msgKey)) {
mb_internal_encoding('UTF-8');
// Build headers
$subject = mb_encode_mimeheader(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'), 'UTF-8', 'B', "\n", 9);
$encoded_app = mb_encode_mimeheader(NOMAPPLICATION, 'UTF-8', 'B', "\n", 6);
$size_encoded_app = (6 + strlen($encoded_app)) % 75;
$size_admin_email = strlen(ADRESSEMAILADMIN);
if ($size_encoded_app + $size_admin_email + 9 > 74) {
$folding = "\n";
} else {
$folding = '';
}
$from = sprintf("From: %s%s <%s>\n", $encoded_app, $folding, ADRESSEMAILADMIN);
$headers = $from;
$headers .= 'Reply-To: ' . ADRESSEMAILREPONSEAUTO . "\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=UTF-8\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "Auto-Submitted:auto-generated\n";
$headers .= 'Return-Path: <>';
// Build body
$body = $body . '<br/><br/>' . __('Mail', 'Thanks for your trust.') . '<br/>' . NOMAPPLICATION . '<hr/>' . __('Mail', 'FOOTER');
// Send mail
$this->sendMail($to, $subject, $body, $msgKey, $headers);
}
}
示例7: postMail
public function postMail($body, $subject, $to, $name, $isHTML = true)
{
require './ThinkPHP/Library/Vendor/PHPMailer/class.smtp.php';
require './ThinkPHP/Library/Vendor/PHPMailer/class.phpmailer.php';
$mail = new \PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->Host = 'mail.lifespring.com.hk';
$mail->Port = '26';
$mail->Username = 'system@lifespring.com.hk';
$mail->Password = '2201sys##';
mb_internal_encoding('UTF-8');
$mail->Subject = mb_encode_mimeheader($subject, 'UTF-8');
$mail->From = 'system@lifespring.com.hk';
$mail->FromName = 'ML Property';
if (!$isHTML) {
$mail->isHTML(false);
$mail->Body = $body;
} else {
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer.';
$mail->MsgHTML($body);
}
$mail->AddAddress($to, $name);
return $mail->Send() ? true : $mail->ErrorInfo;
}
示例8: run
public function run(User $user, $args)
{
$args = explode(' ', $args, 2);
$userName = $args[0];
if (!isset($args[1])) {
RespondError::make($user, ['msg' => 'Вы не ввели сообщения']);
return;
}
$text = $args[1];
$properties = PropertiesDAO::create()->getByUserName($userName);
if (!$properties->getId()) {
RespondError::make($user, ['msg' => "{$userName} не зарегистрирован или имя введено не верно"]);
return;
}
$address = UserDAO::create()->getById($properties->getUserId());
$permissions = new UserActions($user->getUserDAO());
$actions = $permissions->getAllowed($address);
if (!in_array(UserActions::MAIL, $actions)) {
RespondError::make($user, ['msg' => $user->getLang()->getPhrase('NoPermission')]);
return;
}
//@TODO сделать отправку по крону
//также надо ограничить частоту отправки
$config = DI::get()->getConfig();
$mailerName = 'СоциоЧат';
$headers = "MIME-Version: 1.0 \n" . "From: " . mb_encode_mimeheader($mailerName) . "<" . $config->adminEmail . "> \n" . "Reply-To: " . mb_encode_mimeheader($mailerName) . "<" . $config->adminEmail . "> \n" . "Content-Type: text/html;charset=UTF-8\n";
$topic = 'Для вас есть сообщение';
$msg = "<h2>Вам пришло сообщение от пользователя {$user->getProperties()->getName()}</h2>";
$msg .= '<p>' . htmlentities(strip_tags($text)) . '</p>';
$msg .= '<hr>';
$msg .= 'Вернуться в <a href="' . $config->domain->protocol . $config->domain->web . '">СоциоЧат</a>';
mb_send_mail($address->getEmail(), $topic, $msg, $headers);
RespondError::make($user, ['msg' => 'Сообщение отправлено!']);
return ['Сообщение отправлено!', true];
}
示例9: send
public function send($email, $topic, $msg)
{
$config = DI::get()->getConfig()->mail;
$mailerName = $config->name;
$headers = "MIME-Version: 1.0 \n" . "From: " . mb_encode_mimeheader($mailerName) . "<" . $config->adminEmail . "> \n" . "Reply-To: " . mb_encode_mimeheader($mailerName) . "<" . $config->adminEmail . "> \n" . "Content-Type: text/html;charset=UTF-8\n";
mb_send_mail($email, $topic, $msg, $headers);
}
示例10: sendEmail
function sendEmail()
{
$status = "send";
$spamFilter = $this->yellow->config->get("contactSpamFilter");
if (strempty(trim($_REQUEST["message"]))) {
$status = "incomplete";
}
if (!strempty($_REQUEST["from"]) && !filter_var($_REQUEST["from"], FILTER_VALIDATE_EMAIL)) {
$status = "invalid";
}
if (!strempty($_REQUEST["message"]) && preg_match("/{$spamFilter}/i", $_REQUEST["message"])) {
$status = "error";
}
$name = preg_replace("/[^\\pL\\d\\-\\. ]/u", "-", $_REQUEST["name"]);
$from = preg_replace("/[^\\w\\-\\.\\@ ]/", "-", $_REQUEST["from"]);
if ($status == "send") {
$mailMessage = $_REQUEST["message"] . "\r\n-- \r\n{$name}";
$mailTo = $this->yellow->page->get("contactEmail");
if ($this->yellow->config->isExisting("contactEmail")) {
$mailTo = $this->yellow->config->get("contactEmail");
}
$mailSubject = mb_encode_mimeheader($this->yellow->page->get("title"));
$mailHeaders = empty($from) ? "From: noreply\r\n" : "From: " . mb_encode_mimeheader($name) . " <{$from}>\r\n";
$mailHeaders .= "X-Contact-Url: " . mb_encode_mimeheader($this->yellow->page->getUrl()) . "\r\n";
$mailHeaders .= "X-Remote-Addr: " . mb_encode_mimeheader($_SERVER["REMOTE_ADDR"]) . "\r\n";
$mailHeaders .= "Mime-Version: 1.0\r\n";
$mailHeaders .= "Content-Type: text/plain; charset=utf-8\r\n";
$status = mail($mailTo, $mailSubject, $mailMessage, $mailHeaders) ? "done" : "error";
}
return $status;
}
示例11: send_mail
function send_mail($to, $subject, $htmlbody, $altbody, $from_address = null, $from_full_name = '')
{
$mail_conf = new Config('lib/mail.ini');
$subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
$from = mb_encode_mimeheader($mail_conf['application_name']) . '<' . $mail_conf['email_address'] . '>';
$mime_boundary = '=_' . md5(time() . 'todolist.oneksys.cz') . '_=';
$headers = ['MIME-Version: 1.0', 'Content-Type: multipart/alternative; boundary=' . $mime_boundary, 'Content-Transfer-Encoding: 8bit', 'Date: ' . date('r', $_SERVER['REQUEST_TIME']), 'Message-ID: <' . $_SERVER['REQUEST_TIME'] . md5($_SERVER['REQUEST_TIME']) . '@' . $_SERVER['SERVER_NAME'] . '>', 'From: ' . $from, 'Return-Path: ' . $from, 'X-Mailer: PHP/' . phpversion(), 'X-Originating-IP: ' . $_SERVER['SERVER_ADDR']];
if ($from_address !== null) {
$headers[] = 'Reply-To: ' . mb_encode_mimeheader($from_full_name) . '<' . $from_address . '>';
}
$body = '--' . $mime_boundary . "\r\n";
$body .= 'Content-Type: text/plain; charset="charset=utf-8"' . "\r\n";
$body .= 'Content-Transfer-Encoding: 8bit' . "\r\n\r\n";
$body .= wordwrap($altbody, 70);
$body .= "\r\n\r\n";
$body .= '--' . $mime_boundary . "\n";
$body .= 'Content-Type: text/html; charset="UTF-8"' . "\r\n";
$body .= 'Content-Transfer-Encoding: 8bit' . "\r\n\r\n";
$body .= wordwrap($htmlbody, 70);
$body .= "\r\n\r\n";
$body .= '--' . $mime_boundary . '--';
if (mail($to, $subject, $body, implode("\r\n", $headers))) {
return true;
}
return false;
}
示例12: send
/**
* メール送信処理
*/
public function send()
{
// 先ずはチェック
$ret = $this->validation();
// エラーがある場合は終了
if ($ret['status']) {
return $ret;
}
// 宛先作成
$to = $this->createMailToString($this->to);
// FROM作成
if (empty($this->fromName)) {
$this->header .= "From: {$this->from}\n";
} else {
$from_name = mb_encode_mimeheader(mb_convert_encoding($this->fromName, "JIS", "UTF-8"));
$this->header .= "From: {$from_name} <{$this->from}>\n";
}
// CC作成
$cc = $this->createMailToString($this->cc);
if ($cc) {
$this->header .= "Cc: {$cc}\n";
}
// メール送信処理
if (mb_send_mail($to, $this->title, $this->body, $this->header)) {
return $ret;
} else {
$ret['status'] = 1;
@array_push($ret['messages'], '送信処理に失敗しました。');
return false;
}
}
示例13: send_attached_mail
public static function send_attached_mail($to, $subject, $plain_message, $from, $attachment = null, $fileName = null, $attach_mime_type = null)
{
if ($attachment === null) {
self::send_mail($to, $subject, $plain_message, $from);
} else {
$fileName = mb_encode_mimeheader(mb_convert_encoding(basename($fileName), "ISO-2022-JP", 'auto'));
$from = mb_encode_mimeheader(mb_convert_encoding(basename($from), "ISO-2022-JP", 'auto'));
//必要に応じて適宜文字コードを設定してください。
mb_language('Ja');
mb_internal_encoding('UTF-8');
$boundary = '__BOUNDARY__' . md5(rand());
$headers = "Content-Type: multipart/mixed;boundary=\"{$boundary}\"\n";
$headers .= "From: {$from}<{$from}>\n";
$headers .= "Reply-To: {$from}\n";
$body = "--{$boundary}\n";
$body .= "Content-Type: text/plain; charset=\"ISO-2022-JP\"\n";
$body .= "\n{$plain_message}\n";
$body .= "--{$boundary}\n";
$body .= "Content-Type: {$attach_mime_type}; name=\"{$fileName}\"\n";
$body .= "Content-Disposition: attachment; filename=\"{$fileName}\"\n";
$body .= "Content-Transfer-Encoding: base64\n";
$body .= "\n";
$body .= chunk_split(base64_encode($attachment)) . "\n";
$body .= "--{$boundary}--";
$ret = mb_send_mail($to, $subject, $body, $headers);
return $ret;
}
}
示例14: toMailPart
/**
* @return string
*/
public function toMailPart()
{
$eol = Sabel_Mail::getEol();
$encoding = $this->encoding;
$disposition = $this->disposition;
$data = $this->encode($this->content, $encoding, $eol);
$part = array();
if ($this->followRFC2231) {
$part[] = "Content-Type: " . $this->type;
$part[] = "Content-Disposition: " . $this->disposition . ";";
$part[] = $this->toRFC2231($this->name, $eol);
$part[] = "Content-Transfer-Encoding: {$encoding}";
$part[] = $eol . $data . $eol;
} else {
if (extension_loaded("mbstring")) {
$name = mb_encode_mimeheader($this->name, $this->charset);
} else {
$name = "=?{$this->charset}?B?" . base64_encode($this->name) . "?=";
}
$part[] = "Content-Type: " . $this->type . "; name=\"{$name}\"";
$part[] = "Content-Disposition: " . $this->disposition . "; filename=\"{$name}\"";
$part[] = "Content-Transfer-Encoding: {$encoding}";
$part[] = $eol . $data . $eol;
}
return implode($eol, $part);
}
示例15: _send_email
function _send_email($name, $email, $feedback)
{
$from = mb_encode_mimeheader($name, 'UTF-8') . '<' . $email . '>';
$to = FEEDBACK_RECIPIENT;
$subject = mb_encode_mimeheader(FEEDBACK_SUBJECT, 'UTF-8');
$body = addslashes($feedback);
return send_email($from, $to, $subject, $body);
}