function phpmailer_preview in PHPMailer 6
Same name and namespace in other branches
- 5.2 phpmailer.module \phpmailer_preview()
- 6.3 phpmailer.admin.inc \phpmailer_preview()
- 6.2 phpmailer.admin.inc \phpmailer_preview()
- 7.4 phpmailer.admin.inc \phpmailer_preview()
- 7.3 phpmailer.admin.inc \phpmailer_preview()
Menu callback; Render a HTML mail as preview in the browser.
@todo Not ported to 6.x yet.
1 string reference to 'phpmailer_preview'
- phpmailer_menu in ./
phpmailer.module - Implementation of hook_menu().
File
- ./
phpmailer.module, line 138 - This module integrates PHPMailer with Drupal, both as native drupal_mail() wrapper, and as part of the Mime Mail module.
Code
function phpmailer_preview() {
global $user, $base_url;
if (!module_exists('mimemail')) {
drupal_not_found();
exit;
}
$mailkey = 'phpmailer-test';
// Use example address to prevent usage of configurable mail format setting.
$recipient = 'test@example.com';
// @see user_register_submit()
$variables = array(
'!username' => $user->name,
'!site' => variable_get('site_name', 'Drupal'),
'!password' => 'test',
'!uri' => $base_url,
'!uri_brief' => substr($base_url, strlen('http://')),
'!mailto' => $user->mail,
'!date' => format_date(time()),
'!login_uri' => url('user', NULL, NULL, TRUE),
'!edit_uri' => url('user/' . $user->uid . '/edit', NULL, NULL, TRUE),
'!login_url' => user_pass_reset_url($user),
);
$subject = _user_mail_text('welcome_subject', $variables);
$body = _user_mail_text('welcome_body', $variables);
$sender = NULL;
$headers = array();
mimemail_mail_alter($mailkey, $recipient, $subject, $body, $sender, $headers);
print theme('mimemail_message', $body, $mailkey);
exit;
}