🧡 Skip to main content🔍 Skip to search

An example shows how to send an automatic email confirmation, after a customer has placed an order on a legacy application that lacks built-in email capabilities.

Overview

The email data is generated by a custom application or script. The email body contains a header and footer (header.txt and footer.txt files), the customer's details, a list of items purchased, shipping costs and a final price. A copy should also be sent to the accounting department for the record.

Solution

Once a purchase has been completed, the application must generate the email data and call febootimail utility. It can be called from any programming language or a script that allows the execution of other programs.

We recommend to use CONFIG argument for each customer email with a date and time in the filename, so that you have a record of sent emails, and can resend them if necessary. But for the sake of this example, we will not use one.

febootimail -SERVER smtp.example.com
-FROM ""Online Shop, Inc." <onlineshop@example.com>"
-TO ""John Doe" <john@gmail.com>"
-BCC accounting@example.com
-REPLYTO bounceback@example.com
-CHARSET UTF-8
-SUBJECT Automatic receipt of purchase with Online Shop, Inc.
-MSG -USEFILE header.txt
-MSG %customer_name%, %address%, %items%, %shipping%, %total%
-MSG -USEFILE footer.txt
-WAITBEFORE 2

Explanation

The first line executes the Command Line Email tool with the SMTP server defined. This argument can take a hostname or an IP address.

The FROM argument tells a customer where the email is coming from. The quotes marks are necessary for this parameter. The syntax used in the example enables the customer to better understand the sender of the email by using a friendly name, rather than just an obscure email address. Alternatively use the FROMNAME command.

The TO argument should include a customer name as well as an email address. Alternatively use TONAME.

The BCC field allows a blind a carbon copy of the email to be sent to an accounting department for record keeping purposes.

The REPLYTO parameter specifies that the customer's email client should use this address for reply. Since this is an automatically generated email it may be a good idea to mention this to the customer in the body text. Additionally, use REPLYTONAME.

The CHARSET argument defines the encoding for the email. The Unicode character set UTF-8 is the most widely used, and it can represent all the world languages. If you do not specify a charset, then diacritical marks and emoticons may not display correctly in an email client.

The SUBJECT argument defines the subject of the email.

The first MSG command allows you to insert header text in the email.

The second MSG contains the main body text of the confirmation email. The percentage marks are only representative of a string version of the given field. For example the %items_list% part of the argument may contain one or many items. It is up to the application to iterate through the list of items and add each subsequent item to the final generated string.

The last MSG argument defines the use of pre-generated footer text.

The final argument, WAITBEFORE 2 specifies that the febootimail utility will wait 2 seconds before actually attempting to send the email.

Need help?

If you have any questions, please do not hesitate to contact our support team.