JDito Funktionen zum Umgang mit eMails
Methods
addAttachment
addAttachment(
pMailID,pContent,pContentType,pFileName,pInline,pHeader?,pRelatedId?):void
Adds an attachment to the mail.
Note: There are often problems with the contenttype if no matching DataHandler is available.
Parameters
string | number | booleanThe ID of the email.
anyThe contents of the email as an object.
string | number | booleanThe Mime type of the attachment.
string | number | booleanThe file name of the attachment (optional).
boolean'true' adds the attachment as an inline object; otherwise as an attachment.
string[][]The header of the attachment; 'null' for none.
string | number | booleanAll elements with the same ID are grouped into a MimeMultiPart attachment (multipart/related). Specify 'null' if you want to send a separate email for each of them.
Returns
voidThrows
May throw an exception.
addBase64Attachment
addBase64Attachment(
pMailID,pBase64Content,pContentType,pFileName,pInline,pHeader?,pRelatedId?):void
Adds binary data as an attachment.
Parameters
string | number | booleanThe ID of the email.
string | number | booleanThe contents of the email as a Base64-encoded string.
string | number | booleanThe Mime type of the attachment.
string | number | booleanThe file name of the attachment (optional).
boolean'true' adds the attachment as an inline object; otherwise as an attachment.
string[][]The header of the attachment; 'null' for none.
string | number | booleanAll elements with the same ID are grouped into a MimeMultiPart attachment (multipart/related). Specify 'null' if you want to send a separate email for each of them.
Returns
voidThrows
May throw an exception.
addHeader
addHeader(
pMailID,pHeaderName,pHeaderContent):void
Adds header information to an email.
Parameters
string | number | booleanThe ID of the email.
string | number | booleanThe name of the header information.
string | number | booleanThe contents of the header information.
Returns
voidThrows
May throw an exception.
Example
var email = mail.newMail();
mail.addHeader(email, "campaign", vars.getString("$image.campaignid"));
addRecipients
addRecipients(
pMailID,pRecipientType,pRecipients):void
Adds recipients to an email.
Parameters
string | number | booleanThe ID of the email.
string | number | booleanThe type of recipient (mail.RECIPIENT_*)
string[]The recipients, as a string array.
Returns
voidThrows
May throw an exception.
Example
var email = mail.newMail();
mail.addRecipients(email, mail.RECIPIENT_TO, ["m.dean@domain.local", "info@domain.local"]); mail.addRecipients(email, mail.RECIPIENT_CC , ["lisa.sommer@domain.local"); mail.addRecipients(email, mail.RECIPIENT_BCC , [²mailbridge@domain.local"]);
addText
addText(
pMailID,pText,pTextType,pEncoding?,pRelatedId?):void
Adds text to an email.
Parameters
string | number | booleanThe ID of the email.
string | number | booleanThe text to be added.
string | number | booleanThe Mime type of the text, e.g. "text/plain" or "text/html".
string | number | booleanThe encoding to be used.
string | number | booleanAll elements with the same ID are grouped into a MimeMultiPart attachment (multipart/related). Specify 'null' if you want to send a separate email for each of them.
Returns
voidThrows
May throw an exception.
clearMail
clearMail(
pMailID):boolean
Deletes an email from the cache.
Parameters
string | number | booleanThe ID of the email.
Returns
boolean'true' if the email was deleted successfully.
Example
var sentdate = vars.getString("$sys.date");
var email = mail.newMail();
mail.setSender(email, sender);
mail.addRecipients(email, mail.RECIPIENT_TO, recipient);
mail.setSubject(email, subject);
mail.sendMailAs("mailbridge", email);
mail.clearMail([email]);
clearRecipients
clearRecipients(
pMailID,pRecipientType):void
Clears all recipients of the given type from the mail.
Parameters
string | number | booleanThe ID of the email.
string | number | booleanThe type of recipient (mail.RECIPIENT_*)
Returns
voidThrows
May throw an exception.
Example
var email = mailId = mail.newMail(emlFileContent, mail.FORMAT_MIME);
mail.clearRecipients(email, mail.RECIPIENT_TO); mail.clearRecipients(email, mail.RECIPIENT_CC); mail.clearRecipients(email, mail.RECIPIENT_BCC);
copyMessage
copyMessage(
pStoredMessageInfo,pSourceFolder,pDestinationFolder):boolean
Copies a message from one folder to another. For this purpose, the IMAP server copy function is used.
This function can only be called at the server.
Parameters
string | number | booleanThe ID of the message.
string | number | booleanThe source folder.
string | number | booleanThe destination folder.
Returns
boolean'true' if the file was copied.
Throws
May throw an exception.
Example
//Get messages
var messages = mail.getMessagesFor("l.hagg", "Inbox");
// Get the last message as an object
var message = mail.getMessage(messages[messages.length-1], "Inbox");
var copied = mail.copyMessage(message[mail.MAIL_ID], "Inbox", "Important Emails");
copyMessage2
copyMessage2(
pStoredMessageInfo,pSourceFolder,pDestinationFolder):string[]
Copies a message from one folder to another. Copies the message from the mail server to the ADITO server and back.
Should only be used if the standard copy function (e.g. Exchange server function) does not work.
This function can only be called at the server.
Parameters
string | number | booleanThe ID of the message.
string | number | booleanThe source folder.
string | number | booleanThe destination folder.
Returns
string[]String [] with the IDs of the messages that were copied. If an element could not be copied, the array element is 'null'.
Throws
May throw an exception.
Example
// Get messages
var messages = mail.getMessagesFor("l.hagg", "Inbox");
// Get the last message as an object
var message = mail.getMessage(messages[messages.length-1], "Inbox");
mail.copyMessage2(message[mail.MAIL_ID], "Inbox", "Important Emails);
copyMessageFor
copyMessageFor(
pUserTitle,pStoredMessageInfo,pSourceFolder,pDestinationFolder):boolean
Copies a message from one folder to another. For this purpose, the IMAP server xopy function is used.
This function can only be called at the server.
Parameters
string | number | booleanThe login name of the user.
string | number | booleanThe ID of the message.
string | number | booleanThe source folder.
string | number | booleanThe destination folder.
Returns
boolean'true' if the file was copied.
Throws
May throw an exception.
Example
// Get messages
var messages = mail.getMessagesFor("l.hagg", "Inbox");
// Get the last message as an object
var message = mail.getMessage(messages[messages.length-1], "Inbox");
mail.copyMessageFor("l.hagg", message[mail.MAIL_ID], "Inbox", "Important Emails");
copyMessageFor2
copyMessageFor2(
pUserTitle,pStoredMessageInfo,pSourceFolder,pDestinationFolder):string[]
Copies a message from one folder to another.
Does not use the IMAP server copy function, but copies the message from the mail server to the ADITO server and back.
Should only be used if mail.copyMessageFor() cannot be used.
This function can only be called at the server.
Parameters
string | number | booleanThe login name of the user.
string | number | booleanThe ID of the message.
string | number | booleanThe source folder.
string | number | booleanThe destination folder.
Returns
string[]String [] with the IDs of the messages that were copied. If an element could not be copied, the array element is 'null'.
Throws
May throw an exception.
Example
// Get messages
var messages = mail.getMessagesFor("l.hagg", "Inbox");
// Get the last message as an object
var message = mail.getMessage(messages[messages.length-1], "Inbox");
mail.copyMessageFor2("l.hagg", message[mail.MAIL_ID], "Inbox", "Important Emails");
deleteMail
deleteMail(
pIdentifier):boolean
Deletes the mail with the parameters you passed.
Parameters
string | number | booleanThe ID of the email.
Returns
boolean'true' if the email was deleted.
Throws
May throw an exception.
Example
var deleted = mail.deleteMail("12");
deleteMessage
deleteMessage(
pStoredMessageInfo,pFolderName):boolean
Deletes a message associated with the ID of a logged-in user.
This function can only be called at the server.
Parameters
string | number | booleanThe ID of the message.
string | number | booleanThe name of the folder to be used.
Returns
boolean'true' if the message was deleted.
Throws
May throw an exception.
Example
// Get messages
var messages = mail.getMessagesFor("l.hagg", "Inbox");
// Get the last message as an object
var message = mail.getMessage(messages[messages.length-1], "Inbox");
// Display sender
var sender = message[mail.MAIL_SENDER];
question.showMessage(sender);
// Delete message, if desired
var answer = question.askQuestion("Delete message?", question.QUESTION_YESNO, "");
if (answer == "true")
mail.deleteMessage(message[mail.MAIL_ID], "Inbox");
deleteMessageFor
deleteMessageFor(
pUserTitle,pStoredMessageInfo,pFolderName):boolean
Deletes a message associated with the ID of a logged-in user.
This function can only be called at the server.
Parameters
string | number | booleanThe login name of the user.
string | number | booleanThe ID of the message.
string | number | booleanThe name of the folder to be used.
Returns
boolean'true' if the message was deleted.
Throws
May throw an exception.
Example
// Get messages
var messages = mail.getMessagesFor("l.hagg", "Inbox");
// Get the last message as an object
var message = mail.getMessage(messages[messages.length-1], "Inbox");
// Display sender
var sender = message[mail.MAIL_SENDER];
question.showMessage(sender);
// Delete message, if desired
var answer = question.askQuestion("Delete message?", question.QUESTION_YESNO, "");
if (answer == "true")
mail.deleteMessageFor("l.hagg", message[mail.MAIL_ID], "Inbox");
extractAddress
extractAddress(
pAddress):string
Extracts the email address (x[at]x.x) from a complete address that may contain a readable part.
Parameters
string | number | booleanThe complete address.
Returns
stringThe email address.
Throws
May throw an exception.
Example
var messages = mail.getMessagesFor("r.argo", "Inbox");
var message = mail.getMessage(messages[messages.length-1], "Inbox");
var sender = message[mail.MAIL_SENDER];
var sendermail = mail.extractAddress(sender);
question.showMessage(sendermail);
getAttachment
getAttachment(
pMail,pPosition):string
Returns the attachment that is located at the specified position of an email.
Parameters
anyThe email.
numberThe position of the attachment.
Returns
stringThe attachment, Base64-encoded.
Throws
May throw an exception.
Example
var email = mail.getMail("; DB; AO_DATEN; ASYS_MAILREPOSIT; 83; ");
var attachment = mail.getAttachment(email, 1);
getAttachmentHeader
getAttachmentHeader(
pMail,pPosition,pHeaderName):string[]
Returns the headers of an attachment.
Parameters
anyThe email.
numberThe position of the attachment.
string | number | booleanThe name of the header to be retrieved.
Returns
string[]The header values or an empty array if none were found.
Throws
May throw an exception.
Example
var email = mail.getMail("; DB; AO_DATEN; ASYS_MAILREPOSIT; 83; ");
var attachmentHeader = mail.getAttachmentHeader(email, 1, "campaign");
getAttachmentHeaderNames
getAttachmentHeaderNames(
pMail,pPosition):string[]
Returns the header names of an attachment.
Parameters
anyThe email.
numberThe position of the attachment.
Returns
string[]The header names or an empty array if none were found.
Throws
May throw an exception.
Example
var email = mail.getMail("; DB; AO_DATEN; ASYS_MAILREPOSIT; 83; ");
var attachmentHeadernames = mail.getAttachmentHeaderNames(email, 1);
getAttachmentInfos
getAttachmentInfos(
pMail):string[]
Retrieves information on the attachments of an email.
Parameters
anyThe email.
Returns
string[]The attachments in a multi-string array:
Throws
May throw an exception.
Example
var email = mail.getMail("; DB; AO_DATEN; ASYS_MAILREPOSIT; 83; ");
var atts = mail.getAttachmentInfos(email);
getCachedMail
getCachedMail(
pMailID):Map<any,any>
Retrieves the email with the ID passed from the cache.
Parameters
string | number | booleanThe ID of the email.
Returns
Map<any, any>The email from the email cache.
Throws
May throw an exception.
Example
var email = mail.getCachedMail("32321546");
getHeader
getHeader(
pMail,pName):string[]
Returns the headers of an email.
Parameters
anyThe email.
string | number | booleanThe name of the header whose information you want to retrieve.
Returns
string[]The header values or an empty array if no matching headers were found.
Throws
May throw an exception.
Example
var email = mail.getMail("; DB; AO_DATEN; ASYS_MAILREPOSIT; 83; ");
var mailheader = mail.getHeader(email, "org");
getHeaderNames
getHeaderNames(
pMail):string[]
Returns the names of the email headers.
Parameters
anyThe email.
Returns
string[]The names of the email headers, as a string array or an empty array if no matching header values exist.
Throws
May throw an exception.
Example
var email = mail.getMail("; DB; AO_DATEN; ASYS_MAILREPOSIT; 83; ");
var mailheaders = mail.getHeaderNames(email);
getMail
getMail(
pIdentifier):Map<any,any>
Returns the email with the parameters you passed.
Parameters
string | number | booleanThe ID of the email.
Returns
Map<any, any>The email or 'null', if no email exists. To query the contents of the email, you can use the email constants.
Throws
May throw an exception.
Example
var email = mail.getMail("; DB; ADITO; ASYS_MAILREPOSITORY; 057ee1f2-5e0e-46e2-9bd0-eae0f6ba1a49; ");
var sender = email[mail.MAIL_SENDER];
getMessage
getMessage(
pStoredMessageInfo,pFolderName):Map<any,any>
Returns the entire message associated with the ID of a logged-in user you passed.
This function can only be called at the server.
Parameters
string | number | booleanThe ID of the message.
string | number | booleanThe name of the folder to be used.
Returns
Map<any, any>The message as a map.
Throws
May throw an exception.
Example
// Get the IDs of the messages in the Inbox
var messages = mail.getMessagesFor("c.rath", "Inbox");
// Get the entire message object for the last ID
// and retrieve the sender
var message = mail.getMessage(messages[messages.length-1], "Inbox");
var sender = message[mail.MAIL_SENDER];
getMessageFor
getMessageFor(
pUserTitle,pStoredMessageInfo,pFolderName):Map<any,any>
Returns the entire message associated with the ID you passed.
This function can only be called at the server.
Parameters
string | number | booleanThe login name of the user.
string | number | booleanThe ID of the message.
string | number | booleanThe name of the folder to be used.
Returns
Map<any, any>The message as a map.
Throws
May throw an exception.
Example
// Get IDs of the messages in the Inbox
var messages = mail.getMessagesFor("c.rath", "Inbox");
// Get the entire message object for the last ID
// and retrieve the sender
var message = mail.getMessageFor("c.rath", messages[messages.length-1], "Inbox");
var sender = message[mail.MAIL_SENDER];
getMessages
getMessages(
pFolderName):string[]
Retrieves the messages from the folder of the logged-in user.
This function can only be called at the server.
Parameters
string | number | booleanThe name of the folder to be used.
Returns
string[]The identifiers of the messages
Throws
May throw an exception.
Example
var newmailids = mail.getMessages("Inbox");
getMessagesFor
getMessagesFor(
pUserTitle,pFolderName,pCondition?):string[]
Retrieves the messages from the Inbox of a logged-in user.
This function can only be called at the server.
Parameters
string | number | booleanThe login name of the user.
string | number | booleanThe name of the folder to be used.
anyReturns
string[]The identifiers of the messages
Throws
May throw an exception.
Example
<b>Example 1 with search for timestamp</b>
question.showMessage(date.longToDate(past, "dd.MM.yyyy HH:mm"));
var emails = mails.getMessagesFor("Lola Locker", "Inbox", ["received", "<", past]);
<b>Example 2 with search for subject and timestamp</b>
var past = eMath.subInt(vars.getString("$sys.date"), eMath.mulDec(10, datetime.ONE_DAY));
var dateTerm = ["received", "<", past];
var subjectTerm = ["subject", "Attachment"];
var condition = { "and" : [dateTerm, subjectTerm] }
var emails = mail.getMessagesFor("Lola Locker", "Inbox", condition);
getNewMessages
getNewMessages(
pUserTitle?):string[]
Retrieves the new messages from the user's Inbox.
This function can only be called at the server.
Parameters
string | number | booleanThe login name of the user.
Returns
string[]The IDs of the new emails.
Throws
May throw an exception.
Example
var newmailids = mail.getNewMessages("docower");
getRepositoryAlias
getRepositoryAlias():
string
Returns the name of the repository alias for the mail repository.
Warning: This is not the name of the database where the mails are stored in the DB repository. This alias only describes the repository alias.
Within this repository alias, the DB is described in the key "Alias" (only for backend = DB).
Returns
stringThe name of the alias. You can then retrieve the alias data model with project.getAliasModel().
Example
var alias = mail.getRepositoryAlias();
var aliasmodel = project.getAliasModel(alias);
var repository_table = aliasmodel[project.ALIAS_PROPERTIES]["table"];
question.showMessage(repository_table);
hasMail
hasMail(
pIdentifier):boolean
Returns whether an email with a specified ID exists in the email repository.
Parameters
string | number | booleanThe ID of the email.
Returns
boolean'true' if a mail with the ID you passed exists.
Throws
May throw an exception.
Example
//pID is the ID of the history which contains the mail
var mail_id = db.cell([ "select MAIL_ID from HISTORY where HISTORYID = ? "
, [ [ pID, getSingleColumnType("HISTORY", "HISTORYID") ] ]
]);
if(mail.hasMail(mail_id) == true)
{
var email = mail.getMail(mail_id);
var attachments = mail.getAttachmentInfos(email);
//Code to get the infos of the attachment
}
hasNewMessages
hasNewMessages(
pUserTitle?):boolean
Checks whether there are new messages in the Inbox of the user specified.
This function can only be called at the server.
Parameters
string | number | booleanThe login name of the user for whom to check for emails.
Returns
boolean'true' if new emails exist.
Throws
May throw an exception.
Example
var newmails = mail.hasNewMessages("docower");
isValidMailAddress
isValidMailAddress(
pMailAddress,pAllowLocalAddresses?):boolean
Überprüft eine E-Mail Adresse ob sie gültig ist; Es wird nicht geprüft ob die Mailadresse sinnvoll ist oder wirklich exisitert
Parameters
string | number | booleanbooleanDetermines if local addresses (e.g. localhost) should be accepted as valid
Returns
booleantrue if it's a valid address, false if it is not valid.
Throws
May throw an exception.
newMail
newMail(
pMailTextRFC?,pMailFormat?):string
Creates a new email object.
Parameters
string | number | booleanThe contents of the email as RFC2822.
numberThe format of the email. Currently, only mail.FORMAT_MIME is available.
Returns
stringThe ID of the new email.
Throws
May throw an exception.
Example
var mailID = mail.newMail("This is a test email", mail.FORMAT_MIME);
newMailAs
newMailAs(
pUserTitle,pMailTextRFC?,pMailFormat?):string
Creates a new email with the contents you passed.
Parameters
string | number | booleanThe user name based on which you want to create the new email.
string | number | booleanThe contents of the email as RFC2822
numberThe format of the email. Currently, only mail.FORMAT_MIME is available.
Returns
stringThe ID of the new email.
Throws
May throw an exception.
Example
var mailID = mail.newMail("Lola Locker", "This is a test email", mail.FORMAT_MIME);
parseRFC
parseRFC(
pRFC,pCharset?):Map<any,any>
Creates an ADITO email object from an email RFC file.
Parameters
string | number | booleanThe email as a string.
string | number | booleanThe character set of the email.
Returns
Map<any, any>The ADITO email object.
Throws
May throw an exception.
Example
// Parses an .eml file
var file = question.askQuestion("Which file?", question.QUESTION_FILECHOOSER, "");
var rfc = swing.doClientIntermediate(swing.CLIENTCMD_GETDATA, [file, util.DATA_TEXT]);
var mo = mail.parseRFC(rfc, "UTF-8");
question.showMessage(mo[mail.MAIL_SUBJECT]);
registerPrivateKey
registerPrivateKey(
pEmail,pAlgorithm,pKey):void
Registers a private key for email SMIME.
If a key has already been registered, it will be overwritten.
Parameters
string | number | booleanThe email address.
string | number | booleanThe algorithm to be used (DiffieHellmann, DSA, RSA, EC).
string | number | booleanThe Base64-encoded key.
Returns
voidThrows
May throw an exception.
Example
mail.registerPrivateKey("admin@domain.local", "RSA", key);
registerPublicKey
registerPublicKey(
pEmail,pAlgorithm,pKey):void
Registers a public key for email SMIME.
If a key has already been registered, it will be overwritten.
Parameters
string | number | booleanThe email address.
string | number | booleanThe algorithm to be used (DiffieHellmann, DSA, RSA, EC).
string | number | booleanThe Base64-encoded key.
Returns
voidThrows
May throw an exception.
Example
mail.registerPublicKey("admin@domain.local", "RSA", key);
resolveMail
resolveMail(
pName):Map<any,any>
Retrieves a variable from the variable container, checks whether it is an email and returns it in processed form.
This method is used in the mailbridge. Within the mail processes, you can use the $local.mail variable which contains the ID of the email.
With mail.resolveMail(), the email can be processed.
Parameters
string | number | booleanThe name of the variable searched for.
Returns
Map<any, any>The email or 'null' if the variable does not exists, if it is no email or if another error occurred.
Throws
May throw an exception.
Example
var email = mail.resolveMail(vars.getString("$local.mail"));
var sender = email[mail.MAIL_SENDER];
resolveMailAsRFC
resolveMailAsRFC(
pName):string
Retrieves a variable from the variable container, checks whether it is an email and returns it in RCF822 form.
This can be used as failback, when mail.resolveMail throws an error.
Parameters
string | number | booleanThe name of the variable searched for.
Returns
stringThe text or 'null' if the variable does not exists, if it is no email or if another error occurred.
Throws
May throw an exception.
Example
var rfc = mail.resolveMailAsRFC();
sendMail
sendMail(
pMailID):number
Sends an email.
Parameters
string | number | booleanThe ID of the email.
Returns
numberThe number of emails sent.
Throws
May throw an exception.
Example
var sentCount = mail.sendMail("12");
sendMailAs
sendMailAs(
pUserTitle,pMailID):number
Sends an email as the specified user.
Parameters
string | number | booleanThe user name based on which you want to create the new email.
string | number | booleanThe ID of the email.
Returns
numberThe number of emails sent.
Throws
May throw an exception.
Example
var sentCount = mail.sendMailAs("Admin", "12");
sendMails
sendMails(
pMailIDs):number
Sends emails.
Parameters
string[]The IDs of the emails.
Returns
numberThe number of emails sent.
Throws
May throw an exception.
Example
var sentCount = mail.sendMails(["12", "13"]);
sendMailsAs
sendMailsAs(
pUserTitle,pMailIDs):number
Sends emails as the specified user.
Parameters
string | number | booleanThe user name based on which you want to create the new email.
string[]The IDs of the emails.
Returns
numberThe number of emails sent.
Throws
May throw an exception.
Example
var sentCount = mail.sendMailAs("Admin", ["12", "13"]);
setHeader
setHeader(
pMailID,pHeaderName,pHeaderContent):void
Sets the value of the desired header information.
Parameters
string | number | booleanThe ID of the email.
string | number | booleanThe name of the header information.
string | number | booleanThe contents of the header information.
Returns
voidThrows
May throw an exception.
Example
var email = mail.newMail();
mail.addHeader(email, "campaign", vars.getString("$image.campaignid"));
setReminderProcess()
setReminderProcess(
pProcess):void
Sets the process informing the user about new emails.
Parameters
string | number | booleanThe process to be executed.
Returns
voidDeprecated
This API is deprecated.
Throws
May throw an exception.
Example
// in the autostart process
mail.setReminderProcess("lib_yougotmail"); The following local variables are available in the transferred process: - "$local.mailid" : the mailid
setSender
setSender(
pMailID,pSender):void
Sets the sender of an email.
Parameters
string | number | booleanThe ID of the email.
string | number | booleanThe sender to be set.
Returns
voidThrows
May throw an exception.
Example
var email = mail.newMail();
mail.setSender(email, "info@adito.de");
setSMimeEncryption
setSMimeEncryption(
pMailID,pValue):void
Sets the flag that indicates whether the email should be encrypted.
Parameters
string | number | booleanThe ID of the email.
boolean'true' if the email is to be encrypted.
Returns
voidThrows
May throw an exception.
Example
mail.setSMimeEncryption("12345", true);
setSubject
setSubject(
pMailID,pSubject,pEncoding?):void
Adds a subject to an email.
Parameters
string | number | booleanThe ID of the email.
string | number | booleanThe email subject.
string | number | booleanThe encoding to be used for the subject.
Returns
voidThrows
May throw an exception.
Example
var email = mail.newMail();
mail.setSubject(email, "Life begins at the end of your comfort zone.", "UTF-8");
storeMail
storeMail(
pMail):string
Saves an email to the repository.
Parameters
anyThe email as a map, e.g. in the format returned by emails.getMail, emails.getMessage or in the RFC2822 format. The email (map) can only be used in unchanged form.
Returns
stringder Identifier der Mail
Throws
May throw an exception.
Example
var filePath = swing.askQuestion(translate.text("Bitte wählen Sie den Pfad zur .eml Datei die eingelesen werden soll"), swing.QUESTION_FILECHOOSER, null);
if (filePath != null)
{
var mailObj = mail.parseRFC(swing.doClientIntermediate(swing.CLIENTCMD_GETDATA, [filePath]));
mailObj[mail.MAIL_ID] = mail.storeMail(mailObj);
var sender = clearAddr(mailObj[mail.MAIL_SENDER]);
var recipients = mailObj[mail.MAIL_RECIPIENT].split(";").map(function (addr){ return clearAddr(addr); });
process.execute("supportmailbridge", {"sender":sender,"recipients":recipients,"mail":mailObj});
question.showMessage(translate.text("Die Datei wurde eingelesen und verarbeitet")); }
storeMessage
storeMessage(
pStoredMessageInfo,pFolderName):string
Saves a message from a logged-in user in the repository.
This function can only be called at the server.
Parameters
string | number | booleanThe ID of the email.
string | number | booleanThe name of the folder to be used.
Returns
stringThe new identifier.
Throws
May throw an exception.
Example
// Get emails
var messages = mail.getMessagesFor("d.daenzer", "Inbox");
// Save the email in the repository
var mId = mail.storeMessage(messages[0], "Inbox");
// Check whether the email was saved in the repository
var hasM = mail.hasMail(mId);
question.showMessage(hasM);
storeMessageFor
storeMessageFor(
pUserTitle,pStoredMessageInfo,pFolderName):string
Saves a message to the repository.
This function can only be called at the server.
Parameters
string | number | booleanThe login name of the user.
string | number | booleanThe ID of the email.
string | number | booleanThe name of the folder to be used.
Returns
stringThe new identifier.
Throws
May throw an exception.
Example
// Get emails
var messages = mail.getMessagesFor("d.daenzer", "Inbox");
// Save the email in the repository
var mId = mail.storeMessageFor("d.daenzer", messages[0], "Inbox");
// Check whether the email was filed in the repository
var hasM = mail.hasMail(mId);
question.showMessage(hasM);
toRFC
toRFC(
pMail):string
Generates text in RFC format from an email.
Parameters
anyThe email object, for example as generated by mail.newMail() or the email as a map, e.g. from mail.getMail() / mail.getMessage().
Returns
stringThe email in RFC format.
Throws
May throw an exception.
Example
var email = mail.toRFC(mail.resolveMail(vars.getString("$local.mail")));
fileIO.storeData("C:/MailBackups/mail.eml", email, util.DATA_TEXT, false);
Properties
AND
stringsearch criteria linked with AND
FLAG_ANSWERED
stringFlag: Emails answered
FLAG_DELETED
stringFlag: Emails deleted
FLAG_DRAFT
stringFlag: Draft
FLAG_FLAGGED
stringFlag: Emails flagged
FLAG_RECENT
stringFlag: Emails received (recent)
FLAG_SEEN
stringFlag: Emails read
FLAG_USER
stringFlag: User
FORMAT_MIME
numberformat of the email that was passed: MIME
MAIL_ATTACHMENTCOUNT
stringMAIL_HTMLTEXT
stringMAIL_ID
stringMAIL_MESSAGEID
stringMAIL_OBJECT
stringMAIL_RECEIVEDATE
stringMAIL_RECIPIENT
stringMAIL_RECIPIENT_ADDRESSES
stringMAIL_SENDER
stringMAIL_SENDER_ADDRESSES
stringMAIL_SENTDATE
stringMAIL_SUBJECT
stringMAIL_TEXT
stringMAILBRIDGE_ERROR_FILTER
numberMailbridge filtering error.
MAILBRIDGE_ERROR_GETMESSAGE
numberMailbridge error while getting the email
MAILBRIDGE_ERROR_GETSIZE
numberMailbridge error while determining the email size.
MAILBRIDGE_ERROR_LOG
numberMailbridge error during the logging of processing.
MAILBRIDGE_ERROR_POSTHANDLING
numberMailbridge error while postprocessing.
MAILBRIDGE_ERROR_PREHANDLING
numberMailbridge error while preprocessing.
MAILBRIDGE_ERROR_PROCESS
numberMailbridge error while executing the process.
MAILBRIDGE_ERROR_REPOSITORY_STORE
numberMailbridge error while saving data to the repository.
MAILBRIDGE_ERROR_SERVERDELETE
numberMailbridge error while deleting data from the server.
MAILBRIDGE_ERROR_SIZETOOBIG
numberEmail is too big (mailbrige error)
MAILBRIDGE_ERROR_UNKNOWN
numberUnknown mailbridge error.
OR
stringsearch criteria linked with OR
RECIPIENT_BCC
stringRECIPIENT_BCC_ADDRESSES
stringRECIPIENT_CC
stringRECIPIENT_CC_ADDRESSES
stringRECIPIENT_TO
stringRECIPIENT_TO_ADDRESSES
stringTERM_BCC
stringEmail search pattern: BCC Contents of BCC address must match the search criteria
TERM_BODY
stringEmail search pattern: BODY The body text must contain the search criteria
TERM_CC
stringEmail search pattern: CC Contents of CC address must match the search criteria
TERM_FLAG
stringEmail search pattern: FLAG Search for flag; values: 'true' or 'false'
TERM_FROM
stringEmail search pattern: FROM Contents of FROM address must match the search criteria
TERM_RECEIVED
stringEmail search pattern: RECEIVED Search for date of reception; operators: =, invalid input: '<', >, invalid input: '<'=, >=, !=
TERM_SENT
stringEmail search pattern: SENT Search for sending date; operators: =, invalid input: '<', >, invalid input: '<'=, >=, !=
TERM_SIZE
stringEmail search pattern: SIZE Search for size; operators: =, invalid input: '<', >, >=, invalid input: '<'=, !=
TERM_SUBJECT
stringEmail search pattern: SUBJECT The subject text must match the search criteria
TERM_TO
stringEmail search pattern: TO Contents of TO address must match the search criteria