IDEMPIERE-3719 Add display name when sending emails
This commit is contained in:
parent
b2a629155c
commit
91882dcb44
|
@ -72,7 +72,7 @@ public final class EMail implements Serializable
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -2489441683920482601L;
|
private static final long serialVersionUID = 5355436165040508855L;
|
||||||
|
|
||||||
//use in server bean
|
//use in server bean
|
||||||
public final static String HTML_MAIL_MARKER = "ContentType=text/html;";
|
public final static String HTML_MAIL_MARKER = "ContentType=text/html;";
|
||||||
|
@ -602,7 +602,7 @@ public final class EMail implements Serializable
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_from = new InternetAddress (newFrom, true);
|
m_from = createInternetAddress(newFrom);
|
||||||
if (MSysConfig.getBooleanValue(MSysConfig.MAIL_SEND_BCC_TO_FROM, false, Env.getAD_Client_ID(Env.getCtx())))
|
if (MSysConfig.getBooleanValue(MSysConfig.MAIL_SEND_BCC_TO_FROM, false, Env.getAD_Client_ID(Env.getCtx())))
|
||||||
addBcc(newFrom);
|
addBcc(newFrom);
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,7 @@ public final class EMail implements Serializable
|
||||||
InternetAddress ia = null;
|
InternetAddress ia = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ia = new InternetAddress (newTo, true);
|
ia = createInternetAddress(newTo);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -679,7 +679,7 @@ public final class EMail implements Serializable
|
||||||
InternetAddress ia = null;
|
InternetAddress ia = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ia = new InternetAddress (newCc, true);
|
ia = createInternetAddress(newCc);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -719,7 +719,7 @@ public final class EMail implements Serializable
|
||||||
InternetAddress ia = null;
|
InternetAddress ia = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ia = new InternetAddress (bccAddress, true);
|
ia = createInternetAddress(bccAddress);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -758,7 +758,7 @@ public final class EMail implements Serializable
|
||||||
InternetAddress ia = null;
|
InternetAddress ia = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ia = new InternetAddress (newTo, true);
|
ia = createInternetAddress(newTo);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1221,4 +1221,21 @@ public final class EMail implements Serializable
|
||||||
additionalHeaders.add(new ValueNamePair(value, name));
|
additionalHeaders.add(new ValueNamePair(value, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an internet address with personal if the email address is formatted as "Personal <email>"
|
||||||
|
* @param email
|
||||||
|
* @return internet address with personal if defined
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static InternetAddress createInternetAddress(String email) throws Exception {
|
||||||
|
InternetAddress ia = new InternetAddress (email, true);
|
||||||
|
if (email.contains("<") && email.contains(">")) {
|
||||||
|
int idx = email.lastIndexOf("<");
|
||||||
|
String personal = email.substring(0, idx).trim();
|
||||||
|
if (! personal.isEmpty())
|
||||||
|
ia.setPersonal(personal);
|
||||||
|
}
|
||||||
|
return ia;
|
||||||
|
}
|
||||||
|
|
||||||
} // EMail
|
} // EMail
|
||||||
|
|
|
@ -524,7 +524,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringTokenizer st = new StringTokenizer(getTo(), " ,;", false);
|
StringTokenizer st = new StringTokenizer(getTo(), ",;", false);
|
||||||
String to = st.nextToken();
|
String to = st.nextToken();
|
||||||
EMail email = m_client.createEMail(getFrom(), to, getSubject(), replaceBASE64Img(getMessage()), true);
|
EMail email = m_client.createEMail(getFrom(), to, getSubject(), replaceBASE64Img(getMessage()), true);
|
||||||
String status = "Check Setup";
|
String status = "Check Setup";
|
||||||
|
@ -533,7 +533,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
|
||||||
while (st.hasMoreTokens())
|
while (st.hasMoreTokens())
|
||||||
email.addTo(st.nextToken());
|
email.addTo(st.nextToken());
|
||||||
// cc
|
// cc
|
||||||
StringTokenizer stcc = new StringTokenizer(getCc(), " ,;", false);
|
StringTokenizer stcc = new StringTokenizer(getCc(), ",;", false);
|
||||||
while (stcc.hasMoreTokens())
|
while (stcc.hasMoreTokens())
|
||||||
{
|
{
|
||||||
String cc = stcc.nextToken();
|
String cc = stcc.nextToken();
|
||||||
|
|
Loading…
Reference in New Issue