From 7d3473c52ee95df19b71ad800d7ac47df958e3eb Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 8 Apr 2015 10:28:29 -0500 Subject: [PATCH] IDEMPIERE-2554 Mail : add acknowledgement of receipt --- org.adempiere.base/src/org/compiere/util/EMail.java | 8 +++++++- .../org/adempiere/webui/window/WEMailDialog.java | 13 ++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/util/EMail.java b/org.adempiere.base/src/org/compiere/util/EMail.java index 4ef52b143c..b7fe07b46d 100644 --- a/org.adempiere.base/src/org/compiere/util/EMail.java +++ b/org.adempiere.base/src/org/compiere/util/EMail.java @@ -184,6 +184,10 @@ public final class EMail implements Serializable m_smtpPort = smtpPort; } + public void setAcknoledgmentReceipt(boolean ar) { + m_acknowledgementReceipt = ar; + } + /** From Address */ private InternetAddress m_from; /** To Address */ @@ -204,7 +208,7 @@ public final class EMail implements Serializable private String m_smtpHost; private int m_smtpPort; private boolean m_secureSmtp; - + private boolean m_acknowledgementReceipt; /** Attachments */ private ArrayList m_attachments; @@ -335,6 +339,8 @@ public final class EMail implements Serializable // m_msg.setSentDate(new java.util.Date()); m_msg.setHeader("Comments", "iDempiereMail"); + if (m_acknowledgementReceipt) + m_msg.setHeader("Disposition-Notification-To", m_from.getAddress()); // m_msg.setDescription("Description"); // SMTP specifics //m_msg.setAllow8bitMIME(true); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java index afaa6b83ac..638a3bc744 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java @@ -29,10 +29,13 @@ import java.util.StringTokenizer; import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; + import javax.activation.DataSource; + import org.adempiere.webui.AdempiereWebUI; import org.adempiere.webui.component.AttachmentItem; import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Column; import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.ConfirmPanel; @@ -202,7 +205,8 @@ public class WEMailDialog extends Window implements EventListener, ValueC private ConfirmPanel confirmPanel = new ConfirmPanel(true); private Button bAddDefaultMailText; private Div attachmentBox; - + private Checkbox isAcknowledgmentReceipt = new Checkbox(); + @Override public void onPageAttached(Page newpage, Page oldpage) { super.onPageAttached(newpage, oldpage); @@ -227,6 +231,7 @@ public class WEMailDialog extends Window implements EventListener, ValueC lSubject.setValue(Msg.getMsg(Env.getCtx(), "Subject") + ":"); lAttachment.setValue(Msg.getMsg(Env.getCtx(), "Attachment") + ":"); fFrom.setReadonly(true); + isAcknowledgmentReceipt.setLabel(Msg.getMsg(Env.getCtx(), "Acknowledge")); // Grid grid = new Grid(); @@ -266,7 +271,7 @@ public class WEMailDialog extends Window implements EventListener, ValueC row = new Row(); rows.appendChild(row); - row.appendChild(new Label("")); + row.appendChild(isAcknowledgmentReceipt); row.appendChild(fTo); fTo.setHflex("1"); @@ -522,7 +527,9 @@ public class WEMailDialog extends Window implements EventListener, ValueC { email.addAttachment(ds); } - + + email.setAcknoledgmentReceipt(isAcknowledgmentReceipt.isChecked()); + status = email.send(); // if (m_user != null)