AutoSender 4: How to integrate on OS X

From myFMbutler wiki
Jump to: navigation, search

Main Page > AutoSender 4 > OS X > How to integrate

Contents

Create a table

In your solution, create a table named ‘Emails’ (or any other name you prefer).

Create the fields

In this table, create the following fields, preferably using the exact same name (or at least a similar name) for easy configuration - fields in bold are required fields - fields marked with a * are required to be of type ‘text’ :

id * (configure as ‘Auto-enter Serial’)

from (e-mail)

from (name)

to (e-mail)

to (name)

reply to

cc

bcc

subject

body

htmlBody

status *

attachment(s)

feedback

Create AutoSender account and privilege set

The FileMaker account you will be using with AutoSender must have a privilege set that will allow JDBC or XML access. Go to Define ‘Accounts and Privileges’, and create an account, preferably called ‘autosender’. Now assign the autosender account to an AutoSender privilege set (refer to the File-Maker manual for more details about privilege sets).

AS2 EditAccount-2.png

For JDBC

The privilege set must have the Extended Privilege ‘Access via ODBC/JDBC’ [fmxdbc] enabled.

AS2 EditPrivSet-1.png

For XML

The privilege set must have the Extended Privilege for XML access (fmxml) enabled. You also need to define a layout that contains all the mail fields you will be using.

AS2 EditPrivSet XML.png


Make sure the privilege set for the account has access to the ‘Emails’ table you are using. If you want to use custom privileges, the AutoSender account should at least have the following rights:

  • view and edit rights to the ‘Emails’ table (and possibly other linked tables)
  • modifiable access to the ‘status’ field
  • view access to all other fields


AS2 CustomRecordPrivs-1.png


AS2 CustomFieldPrivs.png

Enable JDBC sharing (skip this step when using XML)

For JDBC only

AutoSender uses a FileMaker account to communicate with the database through JDBC, so you need to make sure that ODBC/JDBC sharing for the file is enabled, and specify access by a privilege set of your choice, that has the necessary privileges.


SharingMenu.png


Check the radio button ‘Specify users by privilege set’ (screenshot on the next page).


AS2 xDBCSettings.png


Then click the ‘Specify’ button to grant the AutoSender privilege set access.


AS2 xDBC specifyusers.png

Send e-mail

Once the AutoSender account and privilege set have been created, you are ready to put your solution on the FileMaker Server.

Now create a configuration record in the AutoSender Config application (refer to the Setup manual for more details), and you are ready to start sending messages from your file.

In order to send mail messages from the ‘Emails’ table, do the following:

Create a record

Create a new record in the ‘Emails’ table, either manually or through a script, and make sure the required fields are not empty.

Set status field

Set the field value of the ‘Status’ field to ‘0’ and commit the record. This will trigger AutoSender to send the email message for that record. (you can refer to the 'Send_message' script in our MailExample file to get an idea of how you can integrate this in your solution).

Message sent

While the message is being sent, AutoSender will change the status to ‘2’ and the feedback field will (briefly) display ‘message in mail queue’. Once the message has been sent, AutoSender will update the status field to value ‘1’, and the feedback field will display ‘message sent successfully’ (unless there is an error sending the message - more details about these statuses on the next page).

Auto-enter calculation

You can optionally set an Auto-enter calculation on the feedback field that e.g. also adds a timestamp to the ‘message sent’ message, so you have improved logging. Check the feedback field definition in our MailExample files. It also provides feedback about the error codes.

Mail source field options and restrictions

Field requirements

  • The ‘id’, ‘status’ and ‘feedback’ mail fields should be of type 'text'.
  • The ‘id’ field should be an integer auto-enter serial value, i.e. ‘1, 2, …’ and not something like ‘M001,

M002, …’ or ‘0001, 0002, … ’

  • The <id>, <to>, <from> and <subject> fields must not be empty
  • The <to>, <cc> and <bcc> fields can contain multiple addressees separated by ';', ':', ’,’ or ' ' (colon, semi-colon, comma or space)

Plain text , styled text or custom HTML

The MailExample files contain some examples of the different types of mail messages that can be sent using AutoSender.

Normally, AutoSender will send messages as plain text.

However, you can also send styled text or custom HTML messages:

  • for styled text, you can use FileMaker’s GetasCSS function
  • for custom HTML, just use any editor you’re used to, like e.g. DreamWeaver

For both styled text and custom HTML, you need to make sure the message body starts with the <html> tag, and ends with the </html> tag, otherwise the code will be sent as plain text.


Multi-part mixed messages: If you want to send both an HTML-styled message and a plain text equivalent, put the plain text in the standard ‘body’ field, and put the HTML content in the optional ‘htmlBody’ field. That way, users who receive such a message will be able to view either the HTML version, or the plain text alternative.

Embedded graphics in HTML messages: If you want to embed the graphics you use in an HTML mail, you should add them as attachments with the exact names “attachment_1, attachment_2, …” - all attachments are to be numbered from 1 to n. You can then use them in your HTML code using the tag below:

<img src="cid:attachment_1" border="0">

The name of the attachment in the HTML code should NOT contain the extension,like .jpg, .gif or .png. More information on how to include attachments with AutoSender in the next paragraph.

Attachments

The optional <attachment> field can contain carriage-return separated paths to enclosures.

The path names can be a standard Windows or Mac OS X file path, but can also be an URL that points to an ftp or http server:

C:\Windows\Temp\Test.jpg (Windows file path)

/Users/username/Desktop/Test.jpg (Mac OS X file path)

http://www.myserver.com/docs/Test.jpg (http path)

ftp://login:password@myserver.com/docs/Test.jpg (password-protected FTP path)

NOTE: If you use a standard Windows or Mac OS X path, you need to make sure it is accessible from the machine where AutoSender is running.

Both http and ftp path names can be used with or without http or ftp password protection, depending on your setup. When using http or ftp enclosures, AutoSender will first download the file(s) locally, then send the message.

There is a preference that allows AutoSender to cache these downloaded files locally, so as to avoid frequent downloading of the same file.


You can also send attachments from a container field. An example of how to implement this can be found in our MailExample_XML file. Below is an example URL that demonstrates how to extract attachments from a container in the current record (please refer to the FileMaker "Custom Web Publishing with XML and XSLT" manual for more details):

"http://[username]:[password]@[address of FMS Web Publishing engine]/fmi/xml/cnt/data.pdf?-db=[databasename]&-lay=[layout that contains the container field]&-field=[container]&-recid=Get(RecordID)"


whereby the [username]:[password] are the login and password for the database - this should be an account that has the XML extended privilege turned on.


The "data.pdf" is the file that will be returned to AutoSender, which AutoSender will resolve to the correct filename, based on the container information.


NOTE: it is probably not a good idea to use http or ftp for large enclosures, unless the web or ftp server resides on the local network (or any other high-speed network). Otherwise, mail delivery may be slowed down.

Field Status

The <fieldStatus> field will provide information about the status of the mail message,. The field can contain the following values:

  • empty : e-mail draft - the message is not yet ready to be sent
  • ‘0’ : ready - AutoSender will send the message at the next scheduled connection

Status0.png

  • ‘1’ : sent successfully , - AutoSender has delivered the message via the SMTP server

Status1.png

  • ‘2’ : now sending - AutoSender has put the message in the mail queue.
  • ‘3.XXXX’ : error - AutoSender has found that either the id, to, from, or subject fields are empty.

X will have a value 1 or 0 depending on whether ‘From’ , ‘To’, ‘Subject’ or ‘ID’ is empty. e.g. error 3.1101 means that subject is missing The user will need to make the necessary changes, and then resend the message.

Status3.png

  • ‘4’ : AutoSender finds there is an SMTP relay problem. Usually this means you are attempting to

relay email through an SMTP server, and have not authenticated. It may also imply that the ‘From’ address you are using does not match the SMTP login… Here again, the user will need to make the necessary changes, and then resend the message. Status4.png

  • ‘5’ : "Error - Attachment not found"

AutoSender is unable to find one or more attachments for that message.

  • ‘6’ : "Error - SMTP - Illegal address"

Either the from or to email address are incorrect.

  • ‘7’ : "Error - message was partially delivered - might want to resend"

AutoSender has found a problem with the SMTP server while delivering the message

  • ‘8’ : "Error - message was not delivered - might want to resend"

AutoSender has found a problem with the SMTP server while delivering the message


Our example files include a feedback field, which is a calculation field that will offer textual feedback based on the value in the ‘status’ field.

Fax and SMS examples

AutoSender will basically work with any service that accepts e-mail messages, either e-mail-to-fax, where the attachment contains the information to be faxed, or e-mail-to-SMS, where your SMS text message will be the body of your e-mail message.

Please note that both the fax and SMS examples have been tailored for a specific fax and SMS service, i.e. Interfax and Clickatell. You may need to tweak these examples, depending on the requirements of your fax or SMS provider.

Personal tools