AnsweredAssumed Answered

How to trigger an action with java?

Question asked by elcamino on May 29, 2018
Latest reply on May 30, 2018 by jpotts

Alfresco Community (Build: 201707)
===============================

Contains:
    - Alfresco Platform:    5.2.g
    - Alfresco Share:        5.2.f

 

alfresco-global.properties:

### Outbound SMTP configuration properties - Working example ###
# Sample Gmail settings
mail.host=smtp.gmail.com
mail.port=465
mail.username=elcamino@gmail.com
mail.password=*********
mail.protocol=smtps
mail.smtps.starttls.enable=true
mail.smtps.auth=true

 

Project dependency:
compile group: 'org.alfresco', name: 'alfresco-repository', version: '6.50'  // https://mvnrepository.com..

 

Hello

 

I would like to send a test email with the alfresco built in "send email" action.

What are the theoretical steps needed to do so ?

 

1. Include alfresco-repository dependency in the project

2. Create _Alfresco_sendmail() method (see test code below)

3. And now im a little lost, what next ?

3.1. As you notice there is no authentication hire, what is the logic behind the authentication user pass server ip Where to put those? From what I understand I can not do it with CMIS1.1

 

Hire is my test code.

public void alfrescoSendMail() {'   // replaced _Alfresco_sendmail() with alfrescoSendMail
ActionService actionService = serviceRegistry.getActionService();
Action mailAction = actionService.createAction(MailActionExecuter.NAME);
mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "Hello Mathew!");
mailAction.setParameterValue(MailActionExecuter.PARAM_TO, "elcamino@zmail.com");
mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, "alfresco@bsa.com.au");
mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, "Test message!");
actionService.executeAction(mailAction, null);
}

Outcomes