AnsweredAssumed Answered

mailfrom address when using runas

Question asked by singleton on Jun 1, 2011
Latest reply on Jun 7, 2011 by singleton
Hi,

I've a public webscript, giving the ppl the possibility to retrieve a new password. Since this webscript is called from share without logging in and sets a new password it has a runas admin configuration on the alfresco webscript.

<?xml version="1.0" encoding="UTF-8"?>
<webscript>
   <shortname>Password reset</shortname>
   <description>Reset mechanism for login passwords</description>
   <url>/itanks/resetpassword?email={email}</url>
   <authentication runas="admin">none</authentication>
   <transaction>required</transaction>
</webscript>

Some code

Action act = getActionService().createAction(MailActionExecuter.NAME);
Map<String,Serializable> mailParameters = new HashMap<String,Serializable>();
mailParameters.put(MailActionExecuter.PARAM_TO, emailAddress);
mailParameters.put(MailActionExecuter.PARAM_FROM, emailFrom);
mailParameters.put(MailActionExecuter.PARAM_SUBJECT, emailSubject);
mailParameters.put("text", text);
act.addParameterValues(mailParameters);
act.setExecuteAsynchronously(true);
getActionService().executeAction(act, null);

When setting the properties:
mailParameters.put(MailActionExecuter.PARAM_FROM, emailFrom);
this setting is overruled by alfresco and instead the mail address of the admin user is used. Mail is delivered but with wrong from-address

Is there a way to use a custom from address?

Outcomes