Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef31c26525 | ||
|
|
ed931b7b2c |
@@ -35,3 +35,4 @@ www/css/*.css
|
|||||||
!www/css/bootstrap.min.css
|
!www/css/bootstrap.min.css
|
||||||
|
|
||||||
config-dev.xml
|
config-dev.xml
|
||||||
|
config-prod.xml
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.8.1
|
1.8.2
|
||||||
|
|||||||
+1
-1
@@ -47,5 +47,5 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/bablukid/cagette/issues"
|
"url": "https://github.com/bablukid/cagette/issues"
|
||||||
},
|
},
|
||||||
"version": "1.8.1"
|
"version": "1.8.2"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -233,7 +233,7 @@ class App extends sugoi.BaseApp {
|
|||||||
var mailer:sugoi.mail.IMailer = new sugoi.mail.BufferedMailer();
|
var mailer:sugoi.mail.IMailer = new sugoi.mail.BufferedMailer();
|
||||||
|
|
||||||
if (App.config.DEBUG) {
|
if (App.config.DEBUG) {
|
||||||
// Dev env : emails are written to tmp folder
|
App.log("DEBUGEmailer enabled => emails are written to tmp folder");
|
||||||
mailer = new sugoi.mail.DebugMailer();
|
mailer = new sugoi.mail.DebugMailer();
|
||||||
} else {
|
} else {
|
||||||
if (sugoi.db.Variable.get("mailer") == null) {
|
if (sugoi.db.Variable.get("mailer") == null) {
|
||||||
|
|||||||
+34
-10
@@ -38,8 +38,13 @@ class Messages extends Controller {
|
|||||||
if (form.checkToken()) {
|
if (form.checkToken()) {
|
||||||
var listId = form.getElement("list").value;
|
var listId = form.getElement("list").value;
|
||||||
var dest = getSelection(listId);
|
var dest = getSelection(listId);
|
||||||
|
var subject = form.getValueOf("subject");
|
||||||
|
|
||||||
App.log('about to send emails to listId=<$listId> to destination=${dest.length}');
|
App.log('about to send email <$subject> to listId=<$listId> to ${dest.length} recipient(s)');
|
||||||
|
// Sys.command("sh", [
|
||||||
|
// "-c",
|
||||||
|
// "sendemail -f no-reply@comptoirduvrac.re -s mail1.zourit.net:587 -t pvincent@comptoirduvrac.re -bcc 'pvincent974@gmail.com, pvincent974@laposte.net' -u TEST -m coucou -xu postmaster@comptoirduvrac.re -xp QqQeAPT6EpoK"
|
||||||
|
// ]);
|
||||||
|
|
||||||
var mails = [];
|
var mails = [];
|
||||||
for (d in dest) {
|
for (d in dest) {
|
||||||
@@ -51,15 +56,25 @@ class Messages extends Controller {
|
|||||||
|
|
||||||
// send mail confirmation link
|
// send mail confirmation link
|
||||||
var e = new sugoi.mail.Mail();
|
var e = new sugoi.mail.Mail();
|
||||||
e.setSubject(form.getValueOf("subject"));
|
e.setSender(App.config.get("default_email"));
|
||||||
for (x in mails)
|
e.setSubject(subject);
|
||||||
e.addRecipient(x);
|
|
||||||
|
|
||||||
e.setSender(App.config.get("default_email"), form.getValueOf("senderName"));
|
var replyTo = form.getValueOf("senderMail");
|
||||||
e.setReplyTo(form.getValueOf("senderMail"), form.getValueOf("senderName"));
|
var replyToName = form.getValueOf("senderName");
|
||||||
|
if (replyTo != null)
|
||||||
|
e.setReplyTo(replyTo, replyToName);
|
||||||
|
|
||||||
App.log('add CC header to message: ${e.getSubject()}');
|
if (mails.length > 1) {
|
||||||
e.setHeader("CC", "pvincent@comptoirduvrac.re");
|
var cc = mails.join(",");
|
||||||
|
App.log('add header Cc: $cc');
|
||||||
|
e.setHeader("CC:", cc);
|
||||||
|
// for (x in mails)
|
||||||
|
// e.addRecipient(x);
|
||||||
|
e.addRecipient(e.getSender().email);
|
||||||
|
} else {
|
||||||
|
App.log('no header');
|
||||||
|
e.addRecipient(mails[0]);
|
||||||
|
}
|
||||||
|
|
||||||
// sender : default email ( explicitly tells that the server send an email on behalf of the user )
|
// sender : default email ( explicitly tells that the server send an email on behalf of the user )
|
||||||
// e.setHeader("Sender", App.config.get("default_email"));
|
// e.setHeader("Sender", App.config.get("default_email"));
|
||||||
@@ -67,12 +82,21 @@ class Messages extends Controller {
|
|||||||
var html = app.processTemplate("mail/message.mtt", {text: text, group: app.user.amap, list: getListName(listId)});
|
var html = app.processTemplate("mail/message.mtt", {text: text, group: app.user.amap, list: getListName(listId)});
|
||||||
e.setHtmlBody(html);
|
e.setHtmlBody(html);
|
||||||
|
|
||||||
App.sendMail(e, app.user.getAmap(), listId, app.user);
|
// App.sendMail(e, app.user.getAmap(), listId, app.user);
|
||||||
|
|
||||||
|
// Sys.command("sendemail", [
|
||||||
|
// "-f", "no-reply@comptoirduvrac.re", "-s", "mail1.zourit.net:587", "-t", "pvincent@comptoirduvrac.re", "-bcc",
|
||||||
|
// "pvincent974@gmail.com,pvincent974@laposte.net", "-u", subject, "-m", "alors tout va bien", "-xu", "postmaster@comptoirduvrac.re", "-xp",
|
||||||
|
// "QqQeAPT6EpoK"
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
sys.io.File.saveContent('/tmp/my_file.json', "CONTENT");
|
||||||
|
|
||||||
// store message
|
// store message
|
||||||
var lm = new db.Message();
|
var lm = new db.Message();
|
||||||
lm.amap = app.user.amap;
|
lm.amap = app.user.amap;
|
||||||
lm.recipients = Lambda.array(Lambda.map(e.getRecipients(), function(x) return x.email));
|
// lm.recipients = Lambda.array(Lambda.map(e.getRecipients(), function(x) return x.email));
|
||||||
|
lm.recipients = mails;
|
||||||
lm.title = e.getSubject();
|
lm.title = e.getSubject();
|
||||||
lm.date = Date.now();
|
lm.date = Date.now();
|
||||||
lm.body = e.getHtmlBody();
|
lm.body = e.getHtmlBody();
|
||||||
|
|||||||
Reference in New Issue
Block a user