Skip to Content
0
Former Member
Jun 17, 2015 at 02:41 PM

how to send a email notification from scheduled task script?

20 Views

Hi,

i have to send every day an email to all collaborators of selected MA.

i wrote a script which will be started as scheduled task.

// ... //

sendMaMail(maLink, emailAddress, userName, msg) {

logInfo("sending e-mail to " + userName + " / " + emailAddress + " => msg from field: " + msg + ", link: " + maLink);

sender = session.getAccount();

mailTypeEnum = new MailTypeEnumType(MailTypeEnumType.ODP_CUSTOM_TEMPLATE1);

NotificationUtil.sendNotification(emailAddress, sender, mailTypeEnum , params,null,null);

}

My problem is that "session.getAccount()" return the current user with his email address.

When the script is running as a scheduled task there is no current user logged in and

"session.getAccount()" return a user with the "sys@mail" email address witch is not valid.

Is there any way to send a "system notification" from scheduled task?

thanks und sorry for my terrible english

Waldemar