Allow sending emails as a reply on non-email tickets


Normally you can only finish a ticket with a reply email in todo4teams, when the ticket was generated from a received email. The email-box to which the customer has sent his message is also used to send the response. Therefore the user doesn't have to worry about the address of the mailbox.

Often, however, it is also desirable to answer inquiries with an email that have not been received by email. In these cases it must be determined which email-account is used to send the response.

The following script checks if the ticket has already been assigned to an email-account and addresses in case the mailbox with the ID 4.

Example of the "Accept Action" of a group:

if(task.getSource()==null || !task.getSource().isMailbox() ){
  var box = helper.getMailboxById(4));
  if(box!=null && box.isActive())
        task.setReplyMailbox(box);
}

The user can now activate the checkbox in the finish-dialogue to send an email, paste the customer's email-address and finish the ticket by sending the corresponding e-mail.

In the case that you always want to set a specific mailbox (in this case it is the ID 90) as the starting instance to be active and respond via this mailbox, no matter which way a job originated, please use the following script:

var box = helper.getMailboxById(90);
if(box!=null && box.isActive())
    task.setReplyMailbox(box);