Your system can be configured to automatically send emails for specific events such as customer sale receipts, supplier purchase orders or even notification of customer order arrival. Advanced users can also configure the system to automatically process incoming emails. If you have an externally provided email to TXT service, then customers can receive small messages as TXT in some instances.
Anatomy of an Email
While most people see email as a message on their screen, internally emails are reasonably complex with many options. Originally email started out as simple text messages, then had attachments and later support for web page style graphics. This means that creating an email suitable for all recipents can be challenging, especially with rules that might exist on the receivers system, such as attachment removal (anti virus) or not displaying graphics.
- General purpose email is not guaranteed to be delivered. You may not receive a "bounce" message if it does not work, but you should.
- Email programs will typically display an email in either "text" or "html" mode. As a sender you must send both formats, or at least a message saying something like "this is a HTML message, please view in HTML". Text mode does not have as many formatting options as HTML mode, so things like tables do not always appear nicely laid out.
- When formatting an email, you cannot assume much about the receivers screen size. Many users are now reading email on mobile phones so designing a graphic laden email to fit a desktop screen will probably work, but be awkward for the receiver to read.
- If you send attachments, they might block the email from being delivered, but this often only applies for certain types of attachments, such as trying to send executable programs.
- Attachments over a certain size may be blocked.
- You have no way of knowing what the receiver can read. While Adobe PDF files are popular, they are not readable by every user.
How the System Generates Email
The retail system needs to be able to quickly generate emails that are personalised, but also flexible for different needs. This is achieved using a range of "format" files than define how an email should be presented. Format files are defined using two main file types, .txt files and .docx (Word) files. While word files are used to define the layout and appearance they are converted to HTML, PDF and other formats before sending.
Step by Step
- The system decides it needs to send an email to a user. Lets assume that a purchase order is being sent to a supplier.
- The key facts are stored in a message queue for transmission. The key facts here are the supplier and the purchase order. So the system stores supplier id, purchase order id and a format number (401 in this case) that says we wish to send an initial "here is a new purchase order" type of email.
- A background job selects this entry in the message queue for processing. This is done by GDS servers.
- The file "MessageFormat401.txt" is opened if possible. This will be located in the sub folder "messaging" for customer specific versions or the folder "messaging\base" for Fieldpine standard types. If you edit these templates always save your version in the messaging folder or it might be automatically overwritten.
- The txt file verison of messageformat401 contains some email specific headers, such as To, from and subject. It also contains two "body-part" for text and HTML contents. This system sees the two parts and sends the email as a multipart MIME message. Format files can also include directives to attach other format files. Some areas of the system allow you to specify user specific formats, such as sending a purchase order using different appearances to different suppliers.
- As format files are processed, the system replaces symbols using the %symbol% directives. So you can write email templates such as
Dear %supplier.name%, Here is our purchase order dated %purchaseorder.date%
- Once the base format is processed, attachments are processed in the same manner. You can add several attachments, you can attach the same format file several times in different outputs, such as Word and PDF.
- Text based format files have text and/or html sections only. Any formatting must be done in these files. Word format files define the overall appearance and layout. The rendering engine decodes the Word document, replaces symbols and then tries to produce a near likeness of the word document in the output format. Word is a very advanced format with over 7000 pages defining the internal specification, so most renders can only understand a limited subset of Words abilities, so always test changes to verify they can be displayed.
- Once the individual email has been created, it is submitted directly to your email system. They do not appear in the outbox or sent folder of normal email clients.
Format files are stored in the messaging subfolder of GDS. The "\messaging" folder is always searched first and contains customer specific editted versions. The sub folder "\messaging\base" contains verisons of files provided by Fieldpine and you should not edit these files directly as this foldert WILL be updated automatically causing your edits to be lost.
Message Formats are all numbered and the number indicates the class of the document. The number is placed at the end of the file name just before the extension. Examples: "Big401.docx" or "PO with confirmation slip 401.docx". The system uses these format numbers to identify messages that are of the same class.