户外电子邮件通知与附件在不工作
Alfresco email notification with attachment in not working
我使用的是alfresco社区版5.1。x,我已经配置了带有附件的电子邮件通知不起作用,
var mail = actions.create('mail');
mail.parameters.to='${bmp_traineremail}';
mail.parameters.cc='';
mail.parameters.from='xxx@gmail.com';
mail.parameters.node=bpm_package.children[0];
mail.parameters.subject='Congrats ${bmp_trainername}';
mail.parameters.text='Hello ${trainerempanelment_trainername},'n'
mail.execute(bpm_package);
请帮帮我。
Alfresco不支持开箱即用的邮件附件
您可能需要编辑MailActionExecuter类并为附件添加一个参数,然后将它们添加为mimmultipart消息。像这样:
public static final String PARAM_ATTACHMENTS = "attachments";
public void prepare(MimeMessage mimeMessage) throws MessagingException{
...
MimeMultipart content = new MimeMultipart("mixed");
MimeBodyPart textPart = new MimeBodyPart();
if (isHTML){
textPart.setContent(text, "text/html; charset=utf-8");
} else {
textPart.setText(text);
}
content.addBodyPart(textPart);
List<NodeRef> attachments = (List<NodeRef>) ruleAction.getParameterValue(PARAM_ATTACHMENTS);
if (attachments != null){
for (final NodeRef attachnode : attachments){
MimeBodyPart attachment = new MimeBodyPart();
final String filename = nodeService.getProperty(attachnode, ContentModel.PROP_NAME).toString();
attachment.setFileName(filename);
attachment.setDataHandler(new DataHandler(new DataSource() {
public InputStream getInputStream() throws IOException {
return serviceRegistry.getContentService().getReader(attachnode, ContentModel.PROP_CONTENT).getContentInputStream();
}
public OutputStream getOutputStream() throws IOException {
throw new IOException("Read-only data");
}
public String getContentType() {
return serviceRegistry.getContentService().getReader(attachnode, ContentModel.PROP_CONTENT).getMimetype();
}
public String getName() {
return filename;
}
}));
content.addBodyPart(attachment);
}
}
mimeMessage.setContent(content);
您可以像这样使用mailAction:
ActionService actionService = serviceRegistry.getActionService();
Action mailAction = actionService.createAction(MailActionExecuter.NAME);
mailAction.setParameterValue(MailActionExecuter.PARAM_TO , "me@gmail.com" );
List<NodeRef> attachements = new ArrayList<>();
//TODOD add noderefs to attachements list...
mailAction.setParameterValue(MailActionExecuter.PARAM_ATTACHMENTS, attachements );
actionService.executeAction(mailAction, null);
相关文章:
- 当单元格内容由于forumula从另一个工作表编译数据而更改时发送电子邮件
- 如果谷歌工作表上的指定列发生更改,则发送电子邮件通知
- 换行使用 在电子邮件中工作,但不在购物车中工作
- Excel Web Services 电子邮件 JavaScript 工作表
- 用于验证电子邮件无法正常工作的正则表达式
- GAS扫描工作表,查找值和发送电子邮件不会做任何事情.思潮
- 电子邮件验证无法使用 javascript 正常工作
- 如何使用谷歌应用脚本和谷歌工作表数据逐行发送html电子邮件
- 表单电子邮件验证工作不正常
- 电子邮件表单PHP不工作
- 电话号码和电子邮件验证不工作在javascript与asp .net
- 特定域的电子邮件验证不工作
- HTML表单使用JS验证电子邮件,验证工作,但表单仍然提交
- 电子邮件范围不工作,这是在FB登录中使用的
- 验证电子邮件表单在IE中不工作
- 我的jquery正则表达式不工作(电子邮件地址验证)
- 发送电子邮件与gmail API不工作
- Javascript打开默认的电子邮件客户端不工作
- 如何在使用Powershell脚本发送到Outlook的电子邮件中插入一个工作的HTML按钮
- 户外电子邮件通知与附件在不工作