Use Email Signatures in Scripts


Whenever you send email from scripts you will want to add a matching signature (email footer) to your email text.

These footers are added to email texts automatically when you answer emails with todo4teams.

You will have to add them programatically in scripts, which is fairly easy:

In receive scripts for email configurations the solution is right at hand:

var footer = task.source.sourcemailbox.footer; 

task.source.sourcemailbox is the email box that received the message. The attribute footer contains the signture text.

From any other scripts you will need to add a few lines more.

Please have a look at the list of email boxes configured and note the id of the one, which footer you want to use. Let's say the id is 2 here.

Get the signature text as follows: 

var box = com.proxemo.todo.server.ToDoScheduledTaskDispatcher.getInstance().getAllMailboxes().get(
 new java.lang.Long(2)
);
var footer = box.footer;

The variable footer now contains the signature text. Add it to the email text and send the message using the sendMail methods of the helper object (see the eaxmpe below).

Please note that the footer can be given as plain text or HTML. Set the message text accordingly and set the parameter isHTML to true if your message should be send in HTML format, or false otherwise.

//.....
text += "Betreff Ihrer Nachricht / Subject of your request:<br/><pre>"+ message.getSubject()+"</pre>";
text += "\n<br/><br/>"+footer;
//....
helper.sendmail(
  task.source.sourcemailbox.emailAddress,
  "Ihre Anfrage an / Your request to "+task.source.sourcemailbox.emailAddress,
  text, toEmail, null, null,
  "support@bergener-partner.de",
  true);
// ...