Order confirmation email setup

Example shows how to send an automatic confirmation after a customer has placed an order on a legacy application that lacks email support. 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 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 script that allows the execution of other programs.

* We recommend to use CONFIG parameter 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.

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 on parameters:

1: The first line executes the Command line email tool with the SMTP server defined. This argument can take a hostname or IP address.

2: The FROM parameter tells the 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 FROMNAME command.

3: The TO parameter should include the customer name as well as email address. Alternatively use TONAME.

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

5: The REPLYTO parameter specifies that 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.

6: The CHARSET argument defines encoding for the email. The Unicode character set has been mentioned in the example for convenience.

7: The SUBJECT parameter defines the subject of the email.

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

9: 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.

10: The last MSG parameter defines the use of pre-generated footer text.

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

© 2001–2019 Febooti Ltd.