Sending Email Using the Mandrill Email Service - Alpha Anywhere has always offered Xbasic functions to send email. However, these functions require that you have access to a SMTP mail server. The existing functions in Xbasic include:
Benefits of using a 3rd party emailing service include the easier setup, better deliverability, and access to powerful value added features offered by the service, such as tracking whether people open your email message, etc.
The full functionality of the Mandrill email service can be read by navigating to this address: https://mandrillapp.com/api/docs/index.JSON.html
In order to use the Mandrill email server, you will have to visit their web site and apply for a key. The key allows you to send a certain number of free emails each month. Beyond that, there is a fee.
NOTE: Alpha Software is not involved in any way at all in the fee and does not receive any payment at all if you use the Mandrill service.
There are two different ways in which you can use the email_send_mandrill() function.
1. Simple Method: Define Message Using Xbasic Dot Variable
In the simple method, you define an Xbasic dot variable that defines the properties of the message you want to send and then you call email_send_mandrill(), passing in your Mandrill key and the dot variable. This simple method does not expose all of the functionality of the Mandrill service, but it is very easy to set up and use, and it is great for simple email messages.
For example:
'create a .dot variable to define the message
dim ms as p
ms.send_to = "john@acme.com:John Smith,sally@acme.com:Sally Jones"
ms.send_to_cc = ""
ms.send_to_bcc = ""
ms.from_email = "sales@alpha.com"
ms.subject = "Information You Requested"
ms.message_html = "Here is the <b>information</b> you requested."
ms.message_text = "Plain text version of the message"
ms.attachments = "c:\files\mychart1.pdf,c:\files\mytext1.txt"
Notes About the Properties in the Dot Variable
- email_send()
- email_send2()
- email_send_noprofile()
- email_send_noprofile()
MANDRILL -THE FASTEST WAY TO DELIVER EMAIL
Wherever you and your customers are, Mandrill can deliver your email in milliseconds. We’ve got servers all over the world. Mandrill is a scalable and affordable email infrastructure service, with all the marketing-friendly analytics tools you’ve come to expect from MailChimp.
- The .send_to and .send_to_cc addresses are a comma delimited list of addresses. The email address is followed (optionally) by a colon and then a friendly name.
- The .send_to_bcc property allows you to specify a single bcc address. If you specify more than one address, you will get an error.
- .send_to_cc and .send_to_bcc are optional. You can omit them entirely.
- .attachments is optional. It contains a comma delimited list of filenames to attach to the email.
- .error - a logical value .t. or .f.
- .result - an Xbasic array with one item for each address in the recipient list
- .json - the JSON settings that were constructed from the .dot variable passed into the function. You can use this value as a starting point should you wish to use the second method (described below) for calling the email_send_mandrill() function
- .name - the filename (no drive/path, just the name and extension) of the file.
- .type - the mime type
- .content - the base64 encoded data
Comment