FMStudio Email Module

From FMWebschool Reference

Jump to: navigation, search

The FMStudio Email Module allows FMStudio users to create emails from within their dynamic PHP pages with very little effort. It supports attachments, SMTP connections, and even inline images.

Contents

Version History

Version 1.0.0 (July 09, 2007)

  • Support for sending with both mail() and SMTP
  • Support for repeating fields and inline images within the email body

Version 1.1.0 (July 16, 2007)

  • Added support for using data in the email body from new and edit queries, not only recordsets
  • Fixed a PHP notice that appeared on some configurations
  • Added link to this page

Version 1.1.2 (September 16, 2007)

  • Fixed a bug in the FX.php portion of the module that caused a JavaScript error in the applyServerBehavior function

Version 2.0.0 (October 15, 2009)

  • Added FMStudio Pro compatibility to the module

Quick Tutorial

  • Click within the Dreamweaver Design view to place the cursor at a point where the email will be sent from
  • Select "Server Behaviors -> Modules -> Email -> FMStudio Emailer"
  • Choose a recordset for the email contents
  • Enter the to and from addresses, those can be either database driven or simple hardcoded strings
  • Add a subject
  • Enter the message body, see Body Text Formatting
  • Optionally configure a connection to your mail server with SMTP (the settings should mimic your email client settings)
  • Check the HTML checkbox if you used HTML code within your body text
  • You are done, when you will load the page the email should be sent out!

User Guide

1. Connection Settings

  • On professionally hosted sites using 'mail()' is the quickest method to use email from within FMStudio
  • If you are testing from home, we recommend using SMTP
    • The SMTP host name should be the address of your mail server
    • The SMTP port is typically 25, verify with your email client software for the correct setting if needed
    • The SMTP user and password are specific to the mailbox that you will be using to send out this email

2. Body Text Formatting

  • Use merge field notation to insert FileMaker fields from the selected recordset into the message body such as:
    • Hello <<firstName>> <<lastName>>
  • Repeating fields can be used by appending the repetition number in square brackets such as <<phoneNumber[2]>> for the second repetition.
  • Inline images can be inserted from container fields into the "src" or "background-image" attributes of HTML tags
    • Typical usage: <img src="<<ContainerField>>" alt="Alternative text for this image">
    • When using inline images, the HTML checkbox must be set in the mailer settings

3. Attachments

Attachments within the email module can be either one of two formats:

  • Container fields specified within the attachment field, or optionally a full "http://" URL for a file to attach.
  • Inline container field objects within the body text, works well for inline images and with some extra HTML should work for more advanced objects such as flash files.

4. Sending Multiple Emails

You can send multiple emails by wrapping the email logo within your design view into a repeating region for a recordset. For each record an email will be sent with data within the email settings coming from that specific result row.

5. Sending a Single Email with Multiple Records

When you want to send a single email with many records, such as a whole table of results, you should perform the following steps:

  • Design the result table / section that will be sent using standard Dreamweaver and FMStudio elements
  • Test the page thoroughly to make sure the results look correct within your browser
  • Open the code view and find a location to start capturing the email contents, typically before your "" tag
    • Add the following code to start capturing: <?php ob_start(); ?>
  • Within the code view find the location where email content capturing should stop, this will typically be after your
  • tag
    • Add the following code to stop capturing: <?php $custom_email = ob_get_clean(); ?>
  • Place your cursor in design view _*after*_ the line that assigns the data to 'custom_email'
  • Add an email module object and fill in your settings
  • Within the email module settings click 'Select...' next to the body and choose the type as 'variable' and the name as 'custom_email'
    • The contents of the body should now be '$custom_email'
  • You are done, test the page now to see if there are any issues

Movies

External Links

Personal tools