| 7 | | - | :修正前|$desc = !empty($description) ? $description : mb_strimwidth(preg_replace("/[\r\n]/" ,' ' ,strip_htmltag($this->wiki->render())) ,0 ,256 ,'...'); |
|---|
| 8 | | - | :修正後|$desc = !empty($description) ? $description : ""; |
|---|
| 7 | + | :修正前|$desc = !empty($description) ? $description : mb_strimwidth(preg_replace("/[\r\n]/" ,' ' ,strip_htmltag($this->wiki->render())) ,0 ,256 ,'...'); |
|---|
| 8 | + | :修正後|$desc = !empty($description) ? $description : ""; |
|---|
| 9 | + | |
|---|
| 10 | + | **Mailerクラスのsendメソッド修正 PukiWiki\Mailer.php [#gk28NxI] |
|---|
| 11 | + | 尚、利用しないためsmtp利用の動作は未確認(要:ユーザIDとPASSの設定) |
|---|
| 12 | + | #sh(Php){{ |
|---|
| 13 | + | public static function send($from, $to, $subject, $body, $from_label=''){ |
|---|
| 14 | + | global $smtp_server, $notify_from, $notify_to; |
|---|
| 15 | + | // mb_encode_mimeheader挙動にかかわる大事な指定 |
|---|
| 16 | + | mb_internal_encoding('JIS'); |
|---|
| 17 | + | |
|---|
| 18 | + | $mail = new Mail\Message('ISO-2022-JP'); |
|---|
| 19 | + | // 送信元および、名前 |
|---|
| 20 | + | $mail->setFrom($from, self::to_jis($from_label)); |
|---|
| 21 | + | // 送信先 |
|---|
| 22 | + | $mail->addTo($to); |
|---|
| 23 | + | // 長すぎる日本語件名を分割する |
|---|
| 24 | + | $mail->setSubject(preg_replace('/\s+/', ' ', self::to_jis($subject))); |
|---|
| 25 | + | // 返信先を自分に |
|---|
| 26 | + | $mail->setReplyTo($from); |
|---|
| 27 | + | // メールの内容 |
|---|
| 28 | + | $mail->setBody(self::to_jis($body), "ISO-2022-JP", Mime\Mime::ENCODING_7BIT); |
|---|
| 29 | + | // 本文の文字コード |
|---|
| 30 | + | $mail->getHeaders() |
|---|
| 31 | + | ->addHeaderLine('Content-Type', 'text/plain; charset=iso-2022-jp') |
|---|
| 32 | + | // エラーなら自分に(不要ですが) |
|---|
| 33 | + | ->addHeaderLine('Errors-to', $from) |
|---|
| 34 | + | // 先頭ビット使ってません |
|---|
| 35 | + | ->addHeaderLine('Content-Transfer-Encoding', '7bit') |
|---|
| 36 | + | // メール送信者 |
|---|
| 37 | + | ->addHeaderLine('X-Mailer', S_APPNAME . ' ' . S_VERSION); |
|---|
| 38 | + | // エンコード |
|---|
| 39 | + | $mail->setEncoding(Mime\Mime::ENCODING_BASE64); |
|---|
| 40 | + | |
|---|
| 41 | + | // STMPサーバーが指定されていない場合Sendmailでメールを送る |
|---|
| 42 | + | if (empty($smtp_server)){ |
|---|
| 43 | + | // "-fメアド"でReturn-Path設定 |
|---|
| 44 | + | $transport = new Mail\Transport\Sendmail($notify_from); |
|---|
| 45 | + | $transport->send($mail); |
|---|
| 46 | + | }else{ |
|---|
| 47 | + | $transport = new Mail\Transport\Smtp(); |
|---|
| 48 | + | $options = new Mail\Transport\SmtpOptions(array( |
|---|
| 49 | + | 'name' => $smtp_server, |
|---|
| 50 | + | 'host' => $smtp_server, |
|---|
| 51 | + | 'connection_class' => 'plain', |
|---|
| 52 | + | 'connection_config' => array( |
|---|
| 53 | + | 'username' => 'user', |
|---|
| 54 | + | 'password' => 'pass', |
|---|
| 55 | + | ), |
|---|
| 56 | + | )); |
|---|
| 57 | + | $transport->setOptions($options); |
|---|
| 58 | + | $transport->send($mail); |
|---|
| 59 | + | } |
|---|
| 60 | + | unset($mail); |
|---|
| 61 | + | unset($transport); |
|---|
| 62 | + | } |
|---|
| 63 | + | }} |
|---|
| 64 | + | |
|---|