* Core:
- Auto-redirect HTML pages to HTTPS -FRU
+ * Emails:
+ - #722: Can send a test email to check mail routing -FRU
+
* Lists:
- Asynchronous mail moderation (should avoid server overload) -FRU
[payment_ready]
from="Gestion des paiements" <support@polytechnique.org>
+
+[test_email]
+from="Polytechnique.org" <support@polytechnique.org>
{
return function()
{
- if(ajax.xml_client.readyState == 4) {
- if (ajax.xml_client.status == 200) {
- if (ajax.obj != null) {
- document.getElementById(ajax.obj).innerHTML = ajax.xml_client.responseText;
+ if(ajax.xml_client.readyState == 4) {
+ if (ajax.xml_client.status == 200) {
+ if (ajax.obj != null) {
+ document.getElementById(ajax.obj).innerHTML = ajax.xml_client.responseText;
}
- if (ajax.func != null) {
- ajax.func(ajax.xml_client.responseText);
+ if (ajax.func != null) {
+ ajax.func(ajax.xml_client.responseText);
}
- } else if (ajax.xml_client.status == 403) {
- window.location.reload();
+ } else if (ajax.xml_client.status == 403) {
+ window.location.reload();
}
}
};
var text = encodeURIComponent(document.getElementById(idFrom).value);
if (text == "") {
return false;
- }
+ }
var url = "wiki_preview";
if (!withTitle) {
url += "/notitle";
- }
+ }
Ajax.update_html(idTo, url + "?text=" + text);
if (idShow != null) {
document.getElementById(idShow).style.display = "";
- }
+ }
+}
+
+function sendTestEmail(forlife)
+{
+ Ajax.update_html(null, 'emails/test' + (forlife == null ? '' : '/' + forlife),
+ function() {
+ showTempMessage('mail_sent', "Un mail a été envoyé avec succès"
+ + (forlife == null ? " sur ton adresse." : " sur l'adresse de " + forlife),
+ true); });
+ return false;
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
'emails/redirect' => $this->make_hook('redirect', AUTH_MDP),
'emails/send' => $this->make_hook('send', AUTH_MDP),
'emails/antispam/submit' => $this->make_hook('submit', AUTH_COOKIE),
+ 'emails/test' => $this->make_hook('test', AUTH_PUBLIC),
'admin/emails/duplicated' => $this->make_hook('duplicated', AUTH_MDP, 'admin'),
'admin/emails/watch' => $this->make_hook('duplicated', AUTH_MDP, 'admin'),
- 'admin/emails/lost' => $this->make_hook('lost', AUTH_MDP, 'admin'),
+ 'admin/emails/lost' => $this->make_hook('lost', AUTH_MDP, 'admin'),
);
}
$page->assign('maxsize', ini_get('post_max_size') . 'o');
}
+ function handler_test(&$page, $forlife = null)
+ {
+ global $globals;
+ if (!S::has_perms() || !$forlife) {
+ $forlife = S::v('bestalias');
+ }
+ $mailer = new PlMailer('emails/mail.test.tpl');
+ $mailer->assign('email', $forlife . '@' . $globals->mail->domain);
+ $iterator = XDB::iterator("SELECT email
+ FROM emails AS e
+ INNER JOIN aliases AS a ON (e.uid = a.id)
+ WHERE FIND_IN_SET('active', e.flags) AND a.alias = {?}",
+ $forlife);
+ $mailer->assign('redirects', $iterator);
+ $res = XDB::query("SELECT FIND_IN_SET('femme', u.flags), prenom
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON (a.id = u.user_id)
+ WHERE a.alias = {?}", $forlife);
+ list($sexe, $prenom) = $res->fetchOneRow();
+ $mailer->assign('sexe', $sexe);
+ $mailer->assign('prenom', $prenom);
+ $mailer->send();
+ exit;
+ }
+
function handler_broken(&$page, $warn = null, $email = null)
{
require_once 'emails.inc.php';
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2007 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+function smarty_function_test_email($params, &$smarty) {
+ $label = isset($params['title']) ? $params['title'] : 'Envoyer un mail de test';
+ $forlife = isset($params['forlife']) ? "'" . $params['forlife'] . "'" : '';
+ return '<div class="center">'
+ . ' <div id="mail_sent" style="position: absolute;"></div><br />'
+ . ' <form action="emails/test" method="get" onsubmit="return sendTestEmail(' . $forlife . ')">'
+ . ' <div><input type="submit" name="send" value="' . $label . '" /></div>'
+ . ' </form>'
+ . '</div>';
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
<strong>* à ne modifier qu'avec l'accord express de l'utilisateur !!!</strong>
</p>
+{javascript name="ajax"}
+{test_email forlife=$mr.forlife}
+
<form id="fwds" method="post" action="admin/user#fwds">
<table class="bicol" cellpadding="2" cellspacing="0">
<tr>
{/iterate}
</ul>
{/if}
+ {test_email}
Si tu souhaites <strong>modifier ce reroutage de ton courrier,</strong>
<a href="emails/redirect">il te suffit de te rendre ici !</a>
</td>
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="test_email"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{to addr=$email}
+{subject text="Test de ton adresse `$email`"}
+{elseif $mail_part eq 'wiki'}
+{if $sexe}Chère{else}Cher{/if} {$prenom},
+
+Tu reçois ce mail car tu as demandé la confirmation du bon fonctionnement de ton adresse polytechnicienne {$email}.
+{if $redirects->total() gt 1}Si toutes tes redirections fonctionnent correctement tu devrais recevoir une copie de ce mail
+des boîtes suivantes :
+{iterate from=$redirects item=mail}
+* {$mail.email}
+{/iterate}
+{/if}
+
+Tu trouveras sur le site divers outils pour gérer ton adresse email :
+* [[https://www.polytechnique.org/emails/redirect|La gestion de tes redirections]]
+* [[https://www.polytechnique.org/emails/antispam|La gestion de ton antispam]]
+* [[https://www.polytechnique.org/emails/send|Un formulaire pour envoyer des mails d'où que tu sois]]
+
+N'hésite pas à venir découvrir ou redécouvrir les services du site grâce au [[https://www.polytechnique.org/review|tour d'horizon]].
+
+Merci encore de la confiance que tu portes à nos services.
+
+-- \\
+Très Cordialement,\\
+L'Équipe de Polytechnique.org
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
{/literal}
//]]></script>
{javascript name="jquery"}
+ {test_email}
<div id="redirect-msg" style="position:absolute;"></div><br />
<div class="center">
<table class="bicol" summary="Adresses de redirection">
{if $smarty.foreach.redirect.total eq 1}disabled="disabled"{/if}
onchange="Ajax.update_html(null,'{$globals->baseurl}/emails/redirect/'+(this.checked?'':'in')+'active/{$e->email}', redirectUpdate)" /></td>
<td>
- <select onchange="Ajax.update_html(null,'{$globals->baseurl}/emails/redirect/rewrite/{$e->email}/'+this.value, redirectUpdate)">
+ <select onchange="Ajax.update_html(null,'emails/redirect/rewrite/{$e->email}/'+this.value, redirectUpdate)">
<option value=''>--- aucune ---</option>
{assign var=dom1 value=#globals.mail.domain#}
{assign var=dom2 value=#globals.mail.domain2#}