There are a number of scenarios when email integration is very useful. For example, if you require an enquiry to be sent to a Pengower system, the information can be linked to an application (e.g. this content can be accessed in Communication section of a Client Account).
How to integrate emails into a Pengower system and access email parameters
The example below shows as how we can integrate external emails to the Pengower apps.
//#LONG_RUN //--upload the email communications from the pengower email server-- Set mssArr = Get "Mail Server Settings" Set mss = mssArr Set server = "" + mss["Server"] //Get server replacement text --- Set account = "" + mss["Account"] Set password = "" + mss["Password"] If (server = "") Or (account = "") Or (password = "") Output = "No email integration details" Return_Ok EndIf //Open email account Set ans = Do Open Email Account Params Server = server, Account = account, Password = password If ans != "ok" Output = "Unable to open email account. This is probably because the system is currently processing the email upload. Your emails will be uploaded via this process." Return_Ok EndIf //get all emails in the email account Set arr = Do Get Emails Params Server = server, Account = account, Password = password //close email account Do Close Email Account Params Server = server, Account = account, Password = password Set str = “” //Loop through each downloaded email For i = 1 To arr.Count Set e = arr[i] Set from = e.From Set to = e.To Set CCd = e.CC Set origA = e.Originator Set origToA = e.OriginalTo Set bdy = "" + e.Body Set subject = "" + e.Subject Set str = str + “Email No.” + i + “<br>” + "From:-" + from + "--To:-" + to + "--Originator:-" + orig + "--origTo:-" + origTo + "--Copy:-" + CCd + “ – Subject:-” + subject + “ – Body:-“ + bdy + “<br><br>” Report = "Downloading email " + i + " of " + arr.Count + "..." Progress = i * 100 / arr.Count Next //Output the information downloaded from the email Output = str Return_Ok
//--upload the email communications from the pengower email server--
Mail Server Settings (Type) tells the system which email address to select
- "Server" - Pengower
- "Account" - Email ID Name
- "Password" - Email ID Password
and checks if the Account/Password are OK.
//get all emails in the email account
The script opens the email account to do a particular process and it must be then closed.
//Loop through each downloaded email
For every email, it can pick up the attributes (From, To, 'CC etc)
$Firstname#lastname$ - should be in the subject line (stick to a format)
- From - Pengower
- To - ABC Inc
- CC - email@example.com