mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00
* automatically generate plain mail from html
This commit is contained in:
parent
c415cf5ffb
commit
4535687b48
@ -98,7 +98,7 @@ $config = array(
|
||||
'mail_address' => 'no-reply@your-server.org', // server e-mail address (from:)
|
||||
'mail_admin' => 'your-address@your-server.org', // admin email address, where mails from contact form will be sent
|
||||
'mail_signature' => array( // signature that will be included at the end of every message sent using _mail function
|
||||
'plain' => ''/*'--\nMy Server,\nhttp://www.myserver.com'*/,
|
||||
'plain' => ""/*"--\nMy Server,\nhttp://www.myserver.com"*/,
|
||||
'html' => ''/*'<br/>My Server,\n<a href="http://www.myserver.com">myserver.com</a>'*/
|
||||
),
|
||||
'smtp_enabled' => false, // send by smtp or mail function (set false if use mail function)
|
||||
|
@ -816,9 +816,9 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
|
||||
$signature_html = $config['mail_signature']['html'];
|
||||
|
||||
if($add_html_tags && isset($body[0]))
|
||||
$body = '<html><head></head><body>' . $body . '<br/><br/>' . $signature_html . '</body></html>';
|
||||
$tmp_body = '<html><head></head><body>' . $body . '<br/><br/>' . $signature_html . '</body></html>';
|
||||
else
|
||||
$body .= '<br/><br/>' . $signature_html;
|
||||
$tmp_body .= '<br/><br/>' . $signature_html;
|
||||
|
||||
if($config['smtp_enabled'])
|
||||
{
|
||||
@ -839,7 +839,7 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
|
||||
$mailer->FromName = $config['lua']['serverName'];
|
||||
$mailer->Subject = $subject;
|
||||
$mailer->AddAddress($to);
|
||||
$mailer->Body = $body;
|
||||
$mailer->Body = $tmp_body;
|
||||
|
||||
$signature_plain = '';
|
||||
if(isset($config['mail_signature']['plain']))
|
||||
@ -847,6 +847,9 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
|
||||
|
||||
if(isset($altBody[0]))
|
||||
$mailer->AltBody = $altBody . $signature_plain;
|
||||
else { // automatically generate plain html
|
||||
$mailer->AltBody = strip_tags(preg_replace('/<a(.*)href="([^"]*)"(.*)>/','$2', $body)) . "\n" . $signature_plain;
|
||||
}
|
||||
|
||||
return $mailer->Send();
|
||||
}
|
||||
|
@ -159,19 +159,12 @@ if($save)
|
||||
$new_account->setCustomField('email_hash', $hash);
|
||||
|
||||
$verify_url = getLink('account/confirm_email/' . $hash);
|
||||
$server_name = $config['lua']['serverName'];
|
||||
|
||||
$body_plain = $twig->render('mail.account.verify.plain.html.twig', array(
|
||||
'account' => $tmp_account,
|
||||
'verify_url' => $verify_url
|
||||
));
|
||||
|
||||
$body_html = $twig->render('mail.account.verify.html.twig', array(
|
||||
'account' => $tmp_account,
|
||||
'verify_url' => generateLink($verify_url, $verify_url, true)
|
||||
));
|
||||
|
||||
if(_mail($email, 'New account on ' . $config['lua']['serverName'], $body_html, $body_plain))
|
||||
if(_mail($email, 'New account on ' . $config['lua']['serverName'], $body_html))
|
||||
{
|
||||
echo $twig->render('account.created.verify.html.twig', array(
|
||||
'account' => $tmp_account
|
||||
|
@ -1,11 +0,0 @@
|
||||
Hello!
|
||||
|
||||
Thank you for registering on {{ config.lua.serverName }}!
|
||||
|
||||
Here are the details of your account:
|
||||
Account {% if constant('USE_ACCOUNT_NAME') %}Name{% else %}Number{% endif %}: {{ account }}
|
||||
Password: ************ (hidden for security reasons)
|
||||
|
||||
To verify your email address please click the link below:
|
||||
{{ verify_url }}
|
||||
If you haven't registered on {{ config.lua.serverName }} please ignore this email.
|
Loading…
x
Reference in New Issue
Block a user