====== modMail ====== メールサービスを提供するための抽象クラス。\\ 実装クラス(例:phpmailerのような)で拡張する必要があります。((MODxには標準でphpmailerで拡張したmodPHPMailerが入っています)) 日本語メールを送信するためにはもう一工夫が必要。((エンコーディング周りなど))(([[development:language:php:tips:mb_encode_mimeheader|mb_encode_mimeheader()の文字化けについて]]とか)) getChunk('myEmailTemplate'); $modx->getService('mail', 'mail.modPHPMailer'); $modx->mail->set(modMail::MAIL_BODY,$message); $modx->mail->set(modMail::MAIL_FROM,'me@example.org'); $modx->mail->set(modMail::MAIL_FROM_NAME,'Johnny Tester'); $modx->mail->set(modMail::MAIL_SENDER,'Johnny Tester'); $modx->mail->set(modMail::MAIL_SUBJECT,'Check out my new email template!'); $modx->mail->address('to','user@example.com'); $modx->mail->address('reply-to','me@xexample.org'); $modx->mail->setHTML(true); if (!$modx->mail->send()) { $modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$modx->mail->mailer->ErrorInfo); } $modx->mail->reset(); ?> ===== 参考 ===== [[http://rtfm.modx.com/display/revolution20/modMail|modMail MODx Documentation]]