IDEMPIERE-2132:mails from iDempiere can not be forwarded
This commit is contained in:
parent
36ce8de266
commit
05f9f72aac
|
@ -48,7 +48,6 @@ import javax.mail.internet.MimeMultipart;
|
||||||
|
|
||||||
import org.compiere.model.MClient;
|
import org.compiere.model.MClient;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
|
|
||||||
import com.sun.mail.smtp.SMTPMessage;
|
import com.sun.mail.smtp.SMTPMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -974,18 +973,34 @@ public final class EMail implements Serializable
|
||||||
else // Multi part message ***************************************
|
else // Multi part message ***************************************
|
||||||
{
|
{
|
||||||
// First Part - Message
|
// First Part - Message
|
||||||
MimeBodyPart mbp_1 = new MimeBodyPart();
|
MimeBodyPart htmlPart= null;
|
||||||
mbp_1.setText("");
|
MimeBodyPart planPart = new MimeBodyPart();
|
||||||
if (m_messageHTML == null || m_messageHTML.length () == 0)
|
//TODO: get plan text form html, i see getMessageCRLF just return empty string
|
||||||
mbp_1.setText (getMessageCRLF(), charSetName);
|
planPart.setText (getMessageCRLF(), charSetName);
|
||||||
else
|
htmlPart = new MimeBodyPart();
|
||||||
mbp_1.setDataHandler (new DataHandler
|
if (m_messageHTML == null){
|
||||||
(new ByteArrayDataSource (m_messageHTML, charSetName, "text/html")));
|
m_messageHTML = "<html><body>" + getMessageCRLF() + "</body></html>";
|
||||||
|
}
|
||||||
|
|
||||||
|
htmlPart.setDataHandler (new DataHandler
|
||||||
|
(new ByteArrayDataSource (m_messageHTML, charSetName, "text/html")));
|
||||||
|
|
||||||
// Create Multipart and its parts to it
|
// Create Multipart and its parts to it
|
||||||
Multipart mp = new MimeMultipart("related");
|
Multipart mainPart = new MimeMultipart("mixed");
|
||||||
mp.addBodyPart(mbp_1);
|
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("(multi) " + getSubject() + " - " + mbp_1);
|
Multipart viewContentPart = new MimeMultipart("related");
|
||||||
|
MimeBodyPart viewBodyPart = new MimeBodyPart();
|
||||||
|
viewBodyPart.setContent(viewContentPart);
|
||||||
|
mainPart.addBodyPart(viewBodyPart);
|
||||||
|
|
||||||
|
Multipart textAlternativePart = new MimeMultipart("alternative");
|
||||||
|
//textAlternativePart.addBodyPart(planPart);
|
||||||
|
textAlternativePart.addBodyPart(htmlPart);
|
||||||
|
MimeBodyPart alternativeBodyPart = new MimeBodyPart();
|
||||||
|
alternativeBodyPart.setContent(textAlternativePart);
|
||||||
|
viewContentPart.addBodyPart(alternativeBodyPart);
|
||||||
|
|
||||||
|
if (log.isLoggable(Level.FINE)) log.fine("(multi) " + getSubject() + " - " + htmlPart);
|
||||||
|
|
||||||
// for all attachments
|
// for all attachments
|
||||||
for (int i = 0; i < m_attachments.size(); i++)
|
for (int i = 0; i < m_attachments.size(); i++)
|
||||||
|
@ -1024,12 +1039,14 @@ public final class EMail implements Serializable
|
||||||
if (m_messageHTML != null && m_messageHTML.contains("cid:"+ds.getName())) {
|
if (m_messageHTML != null && m_messageHTML.contains("cid:"+ds.getName())) {
|
||||||
mbp_2.setContentID("<" + ds.getName() + ">");
|
mbp_2.setContentID("<" + ds.getName() + ">");
|
||||||
mbp_2.setDisposition(MimeBodyPart.INLINE);
|
mbp_2.setDisposition(MimeBodyPart.INLINE);
|
||||||
|
viewContentPart.addBodyPart(mbp_2);
|
||||||
|
}else{
|
||||||
|
mainPart.addBodyPart(mbp_2);
|
||||||
}
|
}
|
||||||
mp.addBodyPart(mbp_2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to Message
|
// Add to Message
|
||||||
m_msg.setContent(mp);
|
m_msg.setContent(mainPart);
|
||||||
} // multi=part
|
} // multi=part
|
||||||
} // setContent
|
} // setContent
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue