コード例 #1
0
ファイル: mail.php プロジェクト: manelio/woolr
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='******'&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
0
ファイル: Mail.php プロジェクト: CamTosh/Mediastorrent
 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
0
 /**
  * testSend method
  *
  * @return void
  */
 public function testSendData()
 {
     $email = $this->getMock('CakeEmail', array('message'), array());
     $email->from('*****@*****.**', 'CakePHP Test');
     $email->returnPath('*****@*****.**', 'CakePHP Return');
     $email->to('*****@*****.**', 'CakePHP');
     $email->cc(array('*****@*****.**' => 'Mark Story', '*****@*****.**' => 'Juan Basso'));
     $email->bcc('*****@*****.**');
     $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 <*****@*****.**>" . PHP_EOL;
     $data .= "Return-Path: CakePHP Return <*****@*****.**>" . PHP_EOL;
     $data .= "Cc: Mark Story <*****@*****.**>, Juan Basso <*****@*****.**>" . 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 <*****@*****.**>', $encoded, implode(PHP_EOL, array('First Line', 'Second Line', '.Third Line', '')), $data, '-f');
     $this->MailTransport->send($email);
 }
コード例 #4
0
 public static function mail_to($value, $mails)
 {
     //return md5($value);
     mb_language("japanese");
     mb_internal_encoding("utf-8");
     $email = mb_encode_mimeheader("チラシシステム") . "<*****@*****.**>";
     $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("チラシシステム") . "<*****@*****.**>";
     $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
0
ファイル: contato.php プロジェクト: NaszvadiG/DivaSul
 function enviar($params = array())
 {
     $ok = false;
     $email = $params['email'];
     if (strlen($email) == 0) {
         $email = '*****@*****.**';
     }
     $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
0
ファイル: MailService.php プロジェクト: blr21560/framadate
 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
0
 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 = '******';
     $mail->Password = '******';
     mb_internal_encoding('UTF-8');
     $mail->Subject = mb_encode_mimeheader($subject, 'UTF-8');
     $mail->From = '*****@*****.**';
     $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
0
ファイル: Mail.php プロジェクト: jackblackjack/sociochat
 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
0
ファイル: Mail.php プロジェクト: jackblackjack/sociochat
 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
0
 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
0
ファイル: send_mail.php プロジェクト: WeaponMan/Todolist
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
0
ファイル: Mail.php プロジェクト: vunh1989/evacorp2
 /**
  * メール送信処理
  */
 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
0
ファイル: Mail.php プロジェクト: gammodoking/kindle.server
 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
0
ファイル: File.php プロジェクト: reoring/sabel
 /**
  * @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
0
ファイル: feedback.php プロジェクト: habi/dnscrypt-osxclient
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);
}
コード例 #16
0
 function mailsend($mailto, $subject, $messages)
 {
     mb_language("Ja");
     mb_internal_encoding("UTF-8");
     $mail_from = MAILFROM;
     $mailfrom = "From:" . mb_encode_mimeheader(MAILFROMNAME) . "<{$mail_from}>";
     if (mb_send_mail($mailto, $subject, $messages, $mailfrom)) {
     }
 }
コード例 #17
0
ファイル: Mail.php プロジェクト: GuillaumeCa/Dynamo
 public function send()
 {
     $headers = 'MIME-Version: 1.0' . "\r\n";
     $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
     $headers .= 'From: Dynamo <*****@*****.**>' . "\r\n";
     mb_internal_encoding("UTF-8");
     $this->sujet = mb_encode_mimeheader($this->sujet);
     return mail($this->destinataire, $this->sujet, $this->content, $headers);
 }
コード例 #18
0
ファイル: mail_wrap.class.php プロジェクト: shogirin/php-util
 private function _encodeMimeheaders(array $hedaers)
 {
     mb_internal_encoding("ISO-2022-JP");
     foreach ($hedaers as &$value) {
         $value = mb_encode_mimeheader(mb_convert_encoding($value, "ISO-2022-JP", "UTF-8"), "ISO-2022-JP", "B", "¥r¥n");
     }
     mb_internal_encoding($this->internal_encoding);
     return $hedaers;
 }
コード例 #19
0
ファイル: Value.php プロジェクト: icanboogie/mailer
 public function __toString()
 {
     $value = $this->value;
     $charset = mb_detect_encoding($value);
     if ($charset != 'ASCII') {
         $value = mb_convert_encoding($value, 'UTF-8');
         $value = mb_encode_mimeheader($value);
     }
     return $value;
 }
コード例 #20
0
 public static function execute($subject, $to, $from, $body)
 {
     sfOpenPNEApplicationConfiguration::registerZend();
     $subject = mb_convert_kana($subject, 'KV');
     $mailer = new Zend_Mail('iso-2022-jp');
     $mailer->setHeaderEncoding(Zend_Mime::ENCODING_BASE64)->setFrom($from)->addTo($to)->setSubject(mb_encode_mimeheader($subject, 'iso-2022-jp'))->setBodyText(mb_convert_encoding($body, 'JIS', 'UTF-8'), 'iso-2022-jp', Zend_Mime::ENCODING_7BIT);
     $result = $mailer->send();
     Zend_Loader::registerAutoLoad('Zend_Loader', false);
     return $result;
 }
コード例 #21
0
 /**
  * Takes an unencoded string and produces a Base64 encoded string from it.
  *
  * If the charset is iso-2022-jp, it uses mb_encode_mimeheader instead of
  * default encodeString, otherwise pass to the parent method.
  *
  * @param string $string          string to encode
  * @param int    $firstLineOffset
  * @param int    $maxLineLength   optional, 0 indicates the default of 76 bytes
  * @param string $charset
  *
  * @return string
  */
 public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0, $charset = 'utf-8')
 {
     if (strtolower($charset) === 'iso-2022-jp') {
         $old = mb_internal_encoding();
         mb_internal_encoding('utf-8');
         $newstring = mb_encode_mimeheader($string, $charset, $this->getName(), "\r\n");
         mb_internal_encoding($old);
         return $newstring;
     }
     return parent::encodeString($string, $firstLineOffset, $maxLineLength);
 }
コード例 #22
0
ファイル: Cotmail.php プロジェクト: Alex300/subscribe
 public function send($data)
 {
     if (empty($data['fromName'])) {
         $data['fromName'] = cot::$cfg['maintitle'];
     }
     if (empty($data['fromEmail'])) {
         $data['fromEmail'] = cot::$cfg['adminemail'];
     }
     $fromName = mb_encode_mimeheader($data['fromName'], 'UTF-8', 'B', "\n");
     $headers = "From: \"" . $fromName . "\" <" . $data['fromEmail'] . ">\n" . "Reply-To: <" . cot::$cfg['adminemail'] . ">\n";
     $ret = cot_mail($data['toEmail'], $data['subject'], $data['body'], $headers, false, null, true);
     return $ret;
 }
コード例 #23
0
ファイル: Gmail.php プロジェクト: quelle/Githutil
 public static function send($account_name, $password, $subject, $body, $to = '', $from = '')
 {
     $params = ['host' => 'tls://smtp.gmail.com', 'port' => 465, 'auth' => true, 'protocol' => 'SMTP_AUTH', 'debug' => false, 'username' => $account_name, 'password' => $password];
     $headers = ['To' => $to, 'From' => $from, 'Subject' => mb_encode_mimeheader($subject)];
     $body = mb_convert_encoding($body, 'ISO-2022-JP', 'auto');
     // 大変遺憾ながら、一旦一部エラーを無視させる
     $e_level = error_reporting();
     error_reporting($e_level & ~E_STRICT & ~E_DEPRECATED);
     $smtp = \Mail::factory('smtp', $params);
     $result = $smtp->send($to, $headers, $body);
     error_reporting($e_level);
     return $result;
 }
コード例 #24
0
function sendValidationMail($mail, $validationHash)
{
    // To
    $to = $mail;
    // Subject
    $subject = mb_encode_mimeheader('Bitte bestätigen Sie Ihre Registrierung bei Möbel Mafia.', 'UTF-8');
    // Headers
    $headers = "From: mailrobot@moebel-mafia.com \r\n";
    $headers .= "Reply-To: support@moebel-mafia.com \r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=utf-8\r\n";
    // Message
    $message = '';
    $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
    $message .= '<html lang="de">' . "\r\n";
    $message .= '<head>' . "\r\n";
    $message .= '<title>Möbel Mafia - Bitte bestätigen Sie Ihre Registrierung bei Möbel Mafia.</title>' . "\r\n";
    $message .= '<style type="text/css">' . "\r\n";
    $message .= 'a {color: #fff;}' . "\r\n";
    $message .= 'a.content-link {color: #000;}' . "\r\n";
    $message .= 'a:hover {color: #AC1A23;}' . "\r\n";
    $message .= '</style></head>' . "\r\n";
    $message .= '<body style="font-family:Arial,Helvetica,sans-serif; font-size:12px; background:#FFFFFF; padding:0px; margin:0px; padding-bottom:40px; color:#000000;">' . "\r\n";
    $message .= '<div style="width:700px; font-family:arial,helvetica,sans-serif; padding:10px 0 0 15px;">' . "\r\n";
    $message .= '<table width="700" border="0" cellspacing="0" cellpadding="0">' . "\r\n";
    $message .= '<tr><td align="left"><a href="http://www.moebel-mafia.com"><img src="http://www.moebel-mafia.com/img/moebel-mafia-mail-logo.png" width="150" height="70" border="0" alt="Möbel Mafia logo" /></a></td></tr>' . "\r\n";
    $message .= '<tr><td colspan="2" align="right" height="30"  style="font-weight:800;color:#fff;padding:15px;background:#000;border-bottom:5px solid #AC1A23;">' . "\r\n";
    // TOP TEXT
    $message .= 'Bitte bestätigen Sie Ihre Registrierung bei Möbel Mafia.' . "\r\n";
    $message .= '</td></tr></table></div>' . "\r\n";
    $message .= '<div style="margin-top:15px; width:725px;">' . "\r\n";
    $message .= '<div style="margin-left: 15px;">' . "\r\n";
    $message .= 'Vielen Dank für Ihre Registrierung bei Möbel Mafia.<br /><br />';
    $message .= 'Bitte klicken Sie auf den folgenden Link, um die Eigentümerschaft der von Ihnen angegebenen Mail zu bestätigen:<br /><br />';
    // VALIDATION LINK
    $message .= '<a class="content-link" href="http://www.moebel-mafia.com/validation/' . $validationHash . '" target="_blank">';
    $message .= 'http://www.moebel-mafia.com/validation/' . $validationHash;
    $message .= '</a><br /><br />';
    $message .= 'Wir wünschen Ihnen viel Freude mit Möbel Mafia!<br />';
    $message .= 'Ihr Möbel Mafia-Team<br /><br />';
    $message .= '<p style="text-align:center;color:#fff;padding:25px;background:#000;border-top:5px solid #AC1A23;">&copy; Möbel Mafia <a href="http://www.moebel-mafia.com/impressum" target="_blank">Impressum</a></p><br /><br /><br />';
    $message .= '</div></div></body></html>';
    // Send Mail
    $mailSent = mail($to, $subject, $message, $headers);
    // Check if was sent
    if ($mailSent) {
        return true;
    } else {
        return false;
    }
}
コード例 #25
0
 private function mail_send($mailto_array, $mail_subject, $mail_body)
 {
     // これを指定しないとmb_encode_mimeheader()で正しくエンコードされない
     mb_language('ja');
     mb_internal_encoding('ISO-2022-JP');
     $params = array("host" => "libml3.sf.cybird.ne.jp", "port" => 25, "auth" => false, "username" => "", "password" => "");
     $mailObject = Mail::factory("smtp", $params);
     $headers = array("From" => "*****@*****.**", "To" => implode(',', $mailto_array), "Subject" => mb_encode_mimeheader(mb_convert_encoding($mail_subject, 'ISO-2022-JP', "SJIS")));
     $mail_body = mb_convert_kana($mail_body, "K", "SJIS");
     $mail_body = mb_convert_encoding($mail_body, "ISO-2022-JP", "SJIS");
     $mailObject->send($mailto_array, $headers, $mail_body);
     // 元に戻す
     mb_internal_encoding('SJIS');
 }
コード例 #26
0
ファイル: inc_mail.php プロジェクト: nyimbi/legalcase
function send_email($email, $subject, $texte, $from = "", $headers = "")
{
    global $hebergeur, $queue_mails, $flag_wordwrap, $os_serveur;
    include_lcm('inc_filters');
    if (!$from) {
        $email_envoi = read_meta("email_sender");
        $from = is_valid_email($email_envoi) ? $email_envoi : $email;
    }
    if (!is_valid_email($email)) {
        return false;
    }
    lcm_debug("mail ({$email}): {$subject}");
    $charset = read_meta('charset');
    $headers = "From: {$from}\n" . "MIME-Version: 1.0\n" . "Content-Type: text/plain; charset={$charset}\n" . "Content-Transfer-Encoding: 8bit\n{$headers}";
    $texte = filtrer_entites($texte);
    $subject = filtrer_entites($subject);
    // fignoler ce qui peut l'etre...
    if ($charset != 'utf-8') {
        $texte = str_replace("&#8217;", "'", $texte);
        $subject = str_replace("&#8217;", "'", $subject);
    }
    // encoder le sujet si possible selon la RFC
    if ($GLOBALS['flag_multibyte'] and @mb_internal_encoding($charset)) {
        $subject = mb_encode_mimeheader($subject, $charset, 'Q');
    }
    if ($flag_wordwrap) {
        $texte = wordwrap($texte);
    }
    if ($os_serveur == 'windows') {
        $texte = preg_replace("/\r*\n/", "\r\n", $texte);
        $headers = preg_replace("/\r*\n/", "\r\n", $headers);
    }
    switch ($hebergeur) {
        case 'lycos':
            $queue_mails[] = array('email' => $email, 'sujet' => $subject, 'texte' => $texte, 'headers' => $headers);
            return true;
        case 'free':
            return false;
        case 'online':
            if (!($ret = @email('webmaster', $email, $subject, $texte))) {
                lcm_log("ERROR mail: (online) returned false");
            }
            return $ret;
        default:
            if (!($ret = @mail($email, $subject, $texte, $headers))) {
                lcm_log("ERROR mail: (default) returned false");
            }
            return $ret;
    }
}
コード例 #27
0
 public function testEncodingJIS()
 {
     if (function_exists('mb_convert_encoding')) {
         // base64_encode and split cannot handle long JIS text to fold
         $subject = '長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い件名';
         $encodedWrapperLength = strlen('=?iso-2022-jp?' . $this->encoder->getName() . '??=');
         $old = mb_internal_encoding();
         mb_internal_encoding('utf-8');
         $newstring = mb_encode_mimeheader($subject, 'iso-2022-jp', 'B', "\r\n");
         mb_internal_encoding($old);
         $encoded = $this->encoder->encodeString($subject, 0, 75 - $encodedWrapperLength, 'iso-2022-jp');
         $this->assertEquals($encoded, $newstring, 'Encoded string should decode back to original string for sample ');
     }
 }
コード例 #28
0
ファイル: MailDeliverer.php プロジェクト: icanboogie/mailer
 public function deliver(Message $message)
 {
     $to = (string) $message->to;
     $subject = (string) $message->subject;
     $body = (string) $message;
     $charset = mb_detect_encoding($subject);
     if ($charset != 'ASCII') {
         $subject = mb_convert_encoding($subject, 'UTF-8');
         $subject = mb_encode_mimeheader($subject, 'UTF-8');
     }
     $header = clone $message->header;
     unset($header['To']);
     unset($header['Subject']);
     return mail($to, $subject, $body, $header);
 }
コード例 #29
0
ファイル: setting.php プロジェクト: hiro1173/legacy
 function Legacy_JapaneseUtf8_convLocal(&$text, $mime)
 {
     if ($mime) {
         switch ($mime) {
             case '1':
                 $text = mb_encode_mimeheader($text, LEGACY_MAIL_CHAR, 'B', "\n");
                 break;
             case '2':
                 $text = mb_encode_mimeheader($text, LEGACY_MAIL_CHAR, 'B', "");
                 break;
         }
     } else {
         $text = mb_convert_encoding($text, 'JIS', _CHARSET);
     }
 }
コード例 #30
0
ファイル: mailer.php プロジェクト: carriercomm/shell-2
function mailer_send_mail($email, $receiver_name = "", $subject, $message)
{
    if ($receiver_name != "") {
        $mess = "<h1>Hej " . $receiver_name . ",</h1>";
    } else {
        $mess = "<p><strong>Hej,</strong></p>";
    }
    $mess_content = str_replace("\n", "<br />", $message);
    $mess_content = str_replace("\r", "<br />", $message);
    $mess_content = str_replace("<br /></br />", "</p><p>", $mess_content);
    $mess_content = str_replace("</p><p></p><p>", "</p><p>", $mess_content);
    $mess .= "<p>" . $mess_content . "</p>\r\n\t<p>" . _("Best regards") . ",\r\n\t<br />" . SITE_NAME . "\r\n\t<br />" . _("Presented by Vidde Webb") . "\r\n\t<br />Tel: +46 (0)73 50 66 879 - www.viddewebb.se</a></p>\r\n\t<p>www.facebook.com/ViddeWebb - www.twitter.com/Vidde - www.flattr.com/profile/vidde</p>";
    $headers = "From: " . mb_encode_mimeheader(SITE_NAME) . " <" . CONTACT_EMAIL . "> \n" . "Reply-To: " . mb_encode_mimeheader(SITE_NAME) . " <" . CONTACT_EMAIL . "> \n" . "X-Loopia-Domain: " . str_replace("http://", "", SITE_URL) . " \n" . "X-Mailer: ViddeMailer/1.2";
    mailer_utf8($email, $subject, $mess, $headers);
}