Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $message = $modx->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_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();
- /*https://docs.modx.com/revolution/2.x/developing-in-modx/advanced-development/modx-services/modmail*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement