Create HTML email using MailAction

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2010 02:13 AM
I'm currently using Alfresco's MailAction class to send emails based on a scheduled job definition. From my JavaScript I am able to prepare the message by obtaining a reference to the mailAction object and setting the desired parameters such as:
mail.parameters.to = "to address";mail.parameters.subject = "subject"; mail.parameters.from = "from address";
I was able to successfully but If I attempt to send an HTML snippet, it's sending the email body as if it's a plain text email. I see that the underlying MailActionExecuter class uses the MimeMessageHelper to prepare the email that is to be sent. Of note is the setText() call on the MimeMessageHelper which sets the email body. It seems like the MailActionExecuter uses the setText(text) variant of this method and provides no way of invoking the setText(text, boolean) version which would allow one to specify a boolean value indicating that the body text is HTML.
Is there a way of getting around this, short of having to extend the MailActionExecuter? It seems like it would end up being a lot of duplicated code just to get this working.
Am I missing something here? Any pointer would be greatly appreciated.
Thanks.
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2010 10:30 PM
Any luck so far?
Thanks


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2010 02:39 AM
setText("text",true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2010 04:32 AM
I am sending mail using the Java Script code in my process definition. Like this
var mail = actions.create("mail");
mail.parameters.to = bpm_assignee.properties.email;
mail.parameters.subject = "Review and Approval of Document";
mail.parameters.from = initiator.properties.email;
mail.parameters.text = "Hi ";
mail.execute(bpm_package);
So where I need to set that? setText("text",true);
Pls reply.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2010 06:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2010 06:51 AM
Waiting for ur reply.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2010 07:22 PM
var mail = actions.create("mail2");mail.parameters.to = "savic.prvoslav[at]gmail.com";mail.parameters.subject = "Html test";mail.parameters.from = "savic.prvoslav[at]gmail.com";mail.parameters.text = "My name is Savić Prvoslav<b> if you see this it is very bold</b>";mail.parameters.node=document;mail.execute(document);
I have taken freedom to add send file feature for you, hope this is helpful

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2013 02:15 AM
vikram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2010 02:53 AM
I tried with your code but I have so many issues. this is what I did.
(1)Copied custom-action.jar in /opt/Alfresco/tomcat/webapps/alfresco/WEB-INF/lib location.
(2)changed the review_processdefinition.xml as
var mail = actions.create("mail2");
mail.parameters.to = bpm_assignee.properties.email;
mail.parameters.subject = "Review and Approval of Document";
mail.parameters.from = initiator.properties.email;
mail.parameters.text = "Hi <b> if you see this it is very bold</b> ";
mail.parameters.node=document;
mail.execute(bpm_package);
only these 2 changes. When I restart the server I am getting error and my server is not starting .Log says as below.
11:04:38,939 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
java.lang.RuntimeException: java.net.BindException: Address already in use
at org.subethamail.smtp.server.SMTPServer.start(SMTPServer.java:198)
at org.alfresco.email.server.impl.subetha.SubethaEmailServer.startup(SubethaEmailServer.java:60)
at org.alfresco.email.server.EmailServer.onBootstrap(EmailServer.java:230)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:294)
….
Caused by: java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at org.subethamail.smtp.server.SMTPServer.createServerSocket(SMTPServer.java:304)
at org.subethamail.smtp.server.SMTPServer.start(SMTPServer.java:194)
… 42 more
Also In 2nd way I copied that jar file and put custom-action-context.xml inside /opt/Alfresco/tomcat/shared/classes/alfresco/extension Still the same problem.
I created a class CustomMailActionExecuter.java with your code but there are so many errors as below
(a) import org.alfresco.repo.action.executer.TestModeable; is not there where I will find this class?
(b) inside executeImpl() MimeMessagePreparator mailPreparer = new MimeMessagePreparator(ruleAction, actionedUponNodeRef) shows the error the constructor Object() not defined.
Can you help pls?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2010 05:20 AM
this means that you have port 8080( or some port else) taken

