| 64 |
64 |
private final String charset;
|
| 65 |
65 |
|
| 66 |
66 |
|
| 67 |
|
/** url. */
|
| 68 |
|
private final String urlLinshare;
|
| 69 |
|
|
| 70 |
67 |
|
| 71 |
68 |
/**
|
| 72 |
69 |
* see http://java.sun.com/developer/EJTechTips/2004/tt0625.html for multipart/alternative
|
| ... | ... | |
| 79 |
76 |
*/
|
| 80 |
77 |
|
| 81 |
78 |
public MailNotifierServiceImpl(String smtpServer, String smtpSender, String smtpUser, String smtpPassword,
|
| 82 |
|
boolean needsAuth, String charset, String urlLinshare) {
|
|
79 |
boolean needsAuth, String charset) {
|
| 83 |
80 |
this.smtpServer = smtpServer;
|
| 84 |
81 |
this.smtpSender = smtpSender;
|
| 85 |
82 |
this.smtpUser = smtpUser;
|
| 86 |
83 |
this.smtpPassword = smtpPassword;
|
| 87 |
84 |
this.needsAuth = needsAuth;
|
| 88 |
85 |
this.charset = charset;
|
| 89 |
|
this.urlLinshare = urlLinshare;
|
| 90 |
86 |
}
|
| 91 |
87 |
|
| 92 |
88 |
/** Send notification to a recipient.
|
| ... | ... | |
| 141 |
137 |
html_mp.addBodyPart(rel_bph);
|
| 142 |
138 |
|
| 143 |
139 |
//inline image ?
|
| 144 |
|
String cid = "image.part.1@linshare.org";
|
| 145 |
|
MimeBodyPart rel_bpi = new MimeBodyPart();
|
| 146 |
|
// Initialize and add the image file to the html body part
|
| 147 |
|
rel_bpi.setFileName("logo_linshare_0210x052.png");
|
| 148 |
|
rel_bpi.setText("linshare");
|
| 149 |
|
String imageLogo = urlLinshare;
|
| 150 |
|
if(!imageLogo.endsWith("/")) imageLogo = imageLogo + "/";
|
| 151 |
|
imageLogo = imageLogo + "images/logo_linshare_0210x052.png";
|
| 152 |
|
rel_bpi.setDataHandler(new DataHandler(new URL(imageLogo)));
|
| 153 |
|
rel_bpi.setHeader("Content-ID", "<" + cid + ">");
|
| 154 |
|
rel_bpi.setDisposition("inline");
|
| 155 |
|
html_mp.addBodyPart(rel_bpi);
|
|
140 |
String cid = "image.part.1@linshare.org";
|
|
141 |
MimeBodyPart rel_bpi = new MimeBodyPart();
|
|
142 |
// Initialize and add the image file to the html body part
|
|
143 |
rel_bpi.setFileName("mail_logo.png");
|
|
144 |
rel_bpi.setText("linshare");
|
|
145 |
|
|
146 |
|
|
147 |
rel_bpi.setDataHandler(new DataHandler(getClass().getResource("/org/linagora/linShare/core/service/mail_logo.png")));
|
|
148 |
rel_bpi.setHeader("Content-ID", "<" + cid + ">");
|
|
149 |
rel_bpi.setDisposition("inline");
|
|
150 |
html_mp.addBodyPart(rel_bpi);
|
| 156 |
151 |
|
|
152 |
|
| 157 |
153 |
// Create the second BodyPart of the multipart/alternative,
|
| 158 |
154 |
// set its content to the html multipart, and add the
|
| 159 |
155 |
// second bodypart to the main multipart.
|
| ... | ... | |
| 170 |
166 |
// Connect to smtp server, if needed
|
| 171 |
167 |
if (needsAuth) {
|
| 172 |
168 |
tr.connect(smtpUser, smtpPassword);
|
| 173 |
|
|
|
169 |
messageMim.saveChanges();
|
| 174 |
170 |
tr.sendMessage(messageMim, messageMim.getAllRecipients());
|
| 175 |
171 |
tr.close();
|
| 176 |
172 |
} else {
|