Factorize a little the mails

This commit is contained in:
Olivier PEREZ 2015-04-14 22:32:41 +02:00
parent 95328cb29c
commit 45d14044f8
5 changed files with 7 additions and 8 deletions

View File

@ -14,7 +14,7 @@ class MailService {
} }
function send($to, $subject, $body, $param = '') { function send($to, $subject, $body, $param = '') {
if($this->smtp_allowed == true) { if ($this->smtp_allowed == true) {
mb_internal_encoding('UTF-8'); mb_internal_encoding('UTF-8');
$subject = mb_encode_mimeheader(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'), 'UTF-8', 'B', "\n", 9); $subject = mb_encode_mimeheader(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'), 'UTF-8', 'B', "\n", 9);
@ -39,7 +39,7 @@ class MailService {
$headers .= "Auto-Submitted:auto-generated\n"; $headers .= "Auto-Submitted:auto-generated\n";
$headers .= 'Return-Path: <>'; $headers .= 'Return-Path: <>';
$body = html_entity_decode($body, ENT_QUOTES, 'UTF-8') . __('Mail', 'FOOTER'); $body = $body . '<br/><br/>' . __('Mail', 'Thanks for your trust.') . '<br/>' . NOMAPPLICATION . '<hr/>' . __('Mail', 'FOOTER');
mail($to, $subject, $body, $headers, $param); mail($to, $subject, $body, $headers, $param);
} }

View File

@ -99,10 +99,10 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || (
$message = __('Mail', "This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll."); $message = __('Mail', "This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll.");
$message .= '<br/><br/>'; $message .= '<br/><br/>';
$message .= Utils::htmlEscape($_SESSION['form']->admin_name) . ' ' . __('Mail', 'hast just created a poll called') . ' : "' . Utils::htmlEscape($_SESSION['form']->title, ENT_QUOTES) . '".<br/>'; $message .= Utils::htmlEscape($_SESSION['form']->admin_name) . ' ' . __('Mail', 'hast just created a poll called') . ' : "' . Utils::htmlEscape($_SESSION['form']->title, ENT_QUOTES) . '".<br/>';
$message .= __('Mail', 'Thanks for filling the poll at the link above') . ' :<br/><br/>%s<br/><br/>' . __('Mail', 'Thanks for your trust.') . '<br/>' . NOMAPPLICATION; $message .= __('Mail', 'Thanks for filling the poll at the link above') . ' :<br/><br/>%s';
$message_admin = __('Mail', "This message should NOT be sent to the polled people. It is private for the poll's creator.\n\nYou can now modify it at the link above"); $message_admin = __('Mail', "This message should NOT be sent to the polled people. It is private for the poll's creator.\n\nYou can now modify it at the link above");
$message_admin .= ' :<br/><br/>%s<br/><br/>' . __('Mail', 'Thanks for your trust.') . '<br/>' . NOMAPPLICATION; $message_admin .= ' :<br/><br/>%s';
$message = sprintf($message, Utils::getUrlSondage($poll_id)); $message = sprintf($message, Utils::getUrlSondage($poll_id));
$message_admin = sprintf($message_admin, Utils::getUrlSondage($admin_poll_id, true)); $message_admin = sprintf($message_admin, Utils::getUrlSondage($admin_poll_id, true));

View File

@ -97,10 +97,10 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) ||
$message = __('Mail', "This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll."); $message = __('Mail', "This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll.");
$message .= '<br/><br/>'; $message .= '<br/><br/>';
$message .= Utils::htmlEscape($_SESSION['form']->admin_name) . ' ' . __('Mail', 'hast just created a poll called') . ' : "' . Utils::htmlEscape($_SESSION['form']->title) . '".<br/>'; $message .= Utils::htmlEscape($_SESSION['form']->admin_name) . ' ' . __('Mail', 'hast just created a poll called') . ' : "' . Utils::htmlEscape($_SESSION['form']->title) . '".<br/>';
$message .= __('Mail', 'Thanks for filling the poll at the link above') . ' :<br/><br/>%s<br/><br/>' . __('Mail', 'Thanks for your trust.') . '<br/>' . NOMAPPLICATION; $message .= __('Mail', 'Thanks for filling the poll at the link above') . ' :<br/><br/>%s';
$message_admin = __('Mail', "This message should NOT be sent to the polled people. It is private for the poll's creator.\n\nYou can now modify it at the link above"); $message_admin = __('Mail', "This message should NOT be sent to the polled people. It is private for the poll's creator.\n\nYou can now modify it at the link above");
$message_admin .= ' :<br/><br/>%s<br/><br/>' . __('Mail', 'Thanks for your trust.') . '<br/>' . NOMAPPLICATION; $message_admin .= ' :<br/><br/>%s';
$message = sprintf($message, Utils::getUrlSondage($poll_id)); $message = sprintf($message, Utils::getUrlSondage($poll_id));
$message_admin = sprintf($message_admin, Utils::getUrlSondage($admin_poll_id, true)); $message_admin = sprintf($message_admin, Utils::getUrlSondage($admin_poll_id, true));

View File

@ -291,7 +291,7 @@
"updated a vote.\nYou can find your poll at the link": "vient de mettre à jour un vote.<br/>Vous pouvez retrouver votre sondage avec le lien suivant", "updated a vote.\nYou can find your poll at the link": "vient de mettre à jour un vote.<br/>Vous pouvez retrouver votre sondage avec le lien suivant",
"wrote a comment.\nYou can find your poll at the link": "vient de rédiger un commentaire.<br/>Vous pouvez retrouver votre sondage avec le lien suivant", "wrote a comment.\nYou can find your poll at the link": "vient de rédiger un commentaire.<br/>Vous pouvez retrouver votre sondage avec le lien suivant",
"Thanks for your trust.": "Merci de votre confiance.", "Thanks for your trust.": "Merci de votre confiance.",
"FOOTER": "<hr/><br/>« La route est longue, mais la voie est libre… »<br/>Framasoft ne vit que par vos dons (déductibles des impôts).<br/>Merci d'avance pour votre soutien http://soutenir.framasoft.org.", "FOOTER": "« La route est longue, mais la voie est libre… »<br/>Framasoft ne vit que par vos dons (déductibles des impôts).<br/>Merci d'avance pour votre soutien http://soutenir.framasoft.org.",
"[ADMINISTRATOR] New settings for your poll": "[ADMINISTRATEUR] Changement de configuration du sondage", "[ADMINISTRATOR] New settings for your poll": "[ADMINISTRATEUR] Changement de configuration du sondage",
"You have changed the settings of your poll. \nYou can modify this poll with this link": "Vous avez modifié la configuration de votre sondage.<br/>Vous pouvez modifier ce sondage avec le lien suivant", "You have changed the settings of your poll. \nYou can modify this poll with this link": "Vous avez modifié la configuration de votre sondage.<br/>Vous pouvez modifier ce sondage avec le lien suivant",
"This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll.": "Ceci est le message qui doit être envoyé aux sondés.<br/>Vous pouvez maintenant transmettre ce message à toutes les personnes susceptibles de participer au vote.", "This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll.": "Ceci est le message qui doit être envoyé aux sondés.<br/>Vous pouvez maintenant transmettre ce message à toutes les personnes susceptibles de participer au vote.",

View File

@ -81,7 +81,6 @@ function sendUpdateNotification($poll, $mailService, $name, $type) {
break; break;
} }
$message .= Utils::getUrlSondage($poll->admin_id, true) . "\n\n"; $message .= Utils::getUrlSondage($poll->admin_id, true) . "\n\n";
$message .= __('Mail', 'Thanks for your trust.') . "\n" . NOMAPPLICATION;
$mailService->send($poll->admin_mail, $subject, $message); $mailService->send($poll->admin_mail, $subject, $message);