IDEMPIERE-2554 Mail : add acknowledgement of receipt

This commit is contained in:
Nicolas Micoud 2015-04-08 10:28:29 -05:00
parent 526388b39c
commit 7d3473c52e
2 changed files with 17 additions and 4 deletions

View File

@ -184,6 +184,10 @@ public final class EMail implements Serializable
m_smtpPort = smtpPort; m_smtpPort = smtpPort;
} }
public void setAcknoledgmentReceipt(boolean ar) {
m_acknowledgementReceipt = ar;
}
/** From Address */ /** From Address */
private InternetAddress m_from; private InternetAddress m_from;
/** To Address */ /** To Address */
@ -204,7 +208,7 @@ public final class EMail implements Serializable
private String m_smtpHost; private String m_smtpHost;
private int m_smtpPort; private int m_smtpPort;
private boolean m_secureSmtp; private boolean m_secureSmtp;
private boolean m_acknowledgementReceipt;
/** Attachments */ /** Attachments */
private ArrayList<DataSource> m_attachments; private ArrayList<DataSource> m_attachments;
@ -335,6 +339,8 @@ public final class EMail implements Serializable
// //
m_msg.setSentDate(new java.util.Date()); m_msg.setSentDate(new java.util.Date());
m_msg.setHeader("Comments", "iDempiereMail"); m_msg.setHeader("Comments", "iDempiereMail");
if (m_acknowledgementReceipt)
m_msg.setHeader("Disposition-Notification-To", m_from.getAddress());
// m_msg.setDescription("Description"); // m_msg.setDescription("Description");
// SMTP specifics // SMTP specifics
//m_msg.setAllow8bitMIME(true); //m_msg.setAllow8bitMIME(true);

View File

@ -29,10 +29,13 @@ import java.util.StringTokenizer;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.activation.DataSource; import javax.activation.DataSource;
import org.adempiere.webui.AdempiereWebUI; import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.component.AttachmentItem; import org.adempiere.webui.component.AttachmentItem;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Column; import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
@ -202,7 +205,8 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
private ConfirmPanel confirmPanel = new ConfirmPanel(true); private ConfirmPanel confirmPanel = new ConfirmPanel(true);
private Button bAddDefaultMailText; private Button bAddDefaultMailText;
private Div attachmentBox; private Div attachmentBox;
private Checkbox isAcknowledgmentReceipt = new Checkbox();
@Override @Override
public void onPageAttached(Page newpage, Page oldpage) { public void onPageAttached(Page newpage, Page oldpage) {
super.onPageAttached(newpage, oldpage); super.onPageAttached(newpage, oldpage);
@ -227,6 +231,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
lSubject.setValue(Msg.getMsg(Env.getCtx(), "Subject") + ":"); lSubject.setValue(Msg.getMsg(Env.getCtx(), "Subject") + ":");
lAttachment.setValue(Msg.getMsg(Env.getCtx(), "Attachment") + ":"); lAttachment.setValue(Msg.getMsg(Env.getCtx(), "Attachment") + ":");
fFrom.setReadonly(true); fFrom.setReadonly(true);
isAcknowledgmentReceipt.setLabel(Msg.getMsg(Env.getCtx(), "Acknowledge"));
// //
Grid grid = new Grid(); Grid grid = new Grid();
@ -266,7 +271,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(new Label("")); row.appendChild(isAcknowledgmentReceipt);
row.appendChild(fTo); row.appendChild(fTo);
fTo.setHflex("1"); fTo.setHflex("1");
@ -522,7 +527,9 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
{ {
email.addAttachment(ds); email.addAttachment(ds);
} }
email.setAcknoledgmentReceipt(isAcknowledgmentReceipt.isChecked());
status = email.send(); status = email.send();
// //
if (m_user != null) if (m_user != null)