Incoming Mail Processing Functions
- attachAllFilesFromEmail — Saves all attachments from an incoming email on some issue
- attachFileFromEmail — Saves an attachment from an incoming email on some issue
- getIncomingEmail — Retrieves a structure containing information about the incoming email such as sender, recipients, subject, or body.
- getRawIncomingEmail — This is an alias to the getIncomingEmail() function
- saveAllAttachmentsFromEmail — Saves all attachments from an incoming email
- saveAttachmentFromEmail — Saves an attachment from an incoming email
As opposed to the server routines, we use here full structures because we have access to the whole email.
IncomingMail
string subject;
string body;
string htmlBody;
string [] to;
string [] cc;
string [] from;
string [] replyTo;
IncomingEmailHeader [] headers;
IncomingEmailAttachment [] attachments;
string contentType;
date sentAt;
date receivedAt;
int size;
IncomingMail [] embeddedMessages;
IncomingEmailHeader
string name;
string value;
IncomingEmailAttachment
string fileName;
string contentType;
int size;
byte [] content;
Example usage
Standard processing:
IncomingEmail mail = getIncomingEmail();
string issueKey = mail.subject;
if(issueExists(issueKey)) {
// add comment
string commentText = mail.body;
string userCommenting = getUserByEmail(mail.from).key;
addComment(issueKey, userCommenting, commentText);
attachAllFilesFromEmail(issueKey);
} else {
// create issue
string summary = mail.subject;
string description = mail.body;
string [] fields = {};
fields += {"reporter", getUserByEmail(mail.from).key};
createIssue("SCRUM", "", "Task", summary , "Minor", description, {}, "", "", fields);
}
Peacock
Need support? Create a request with our support team.
Copyright © 2005 - 2025 Appfire | All rights reserved.