Xataface Email Module
Deprecated: This wiki page pertains to version 0.1 and 0.2 of the Email module which is deprecated. For the documentation on the current email module, here.
The Xataface Email module allows you to convert your database into a mailing list so that you can easily send email to any found set of records, as long as the records contain an email address to send to. Features
Requirements
Downloadhttps://sourceforge.net/project/platformdownload.php?group_id=253820 Installation
ConfigurationThough the email action may work out of the box, you will likely have to configure it to work the way you want. Some examples of things you will want to configure include:
Overriding the [email] actionThe first thing you need to do to configure the email action is override it in your appliation's actions.ini file. You can do this by adding the following to your actions.ini file:
Now any directives you add in this section will override the email action. Examples:Limiting email action to certain tablesIn your appliation's actions.ini file:
Limiting email action by permissionBy default your users require the email permission in order to have access to the email form. This permission is not included with any roles by default so you'll need to extend any roles that you want to have access to the email access and explicitly add the email permission. The exception to this rule is if you have assigned your users the Dataface_PermissionsTool::ALL() permissions in your getPermissions() method. Suppose you want the READ ONLY role to have access to the email action, you could add the following to your application's permissions.ini file:
Changing the name of the email address columnBy default, the Email module will try to guess which column contains the email address for a table. Generally it looks for a column named email. You can override this setting to explicitly tell the module which column contains the email address by overriding the email_column directive of the email action in your application's actions.ini file:
=Changing the name of the table that stores the sent emailXataface automatically stores each sent email for your records. By default it stores these emails in a table named newsletters. You can override this table name with the email_table directive in your application's actions.ini file. This table will be automatically created by Xataface when email is sent out.
Altogether
Usage:Sending Email to All Records of a Table
Opting Out of the Email ListIf you have received an email that was sent via the email module you can easily opt out of the mailing list by clicking on the link at the end of the email. This link will bring you to a webpage that asks you to confirm that you no longer wish to receive email from this list. Using a View to add Email Action to Related Record ListYou can simulate a many-to-many relationship in a mysql view by creating a view with all possible combinations. e.g. If you have a Many to Many relationship between books and authors your relationship from the books table might be something like:
And your relationship from the authors table would be something like:
Now if our goal was to be able to send email to all authors of a particular book (i.e. send to the authors relationship), we could create a view:
This view can now be used in xataface like a regular table (if you add a fields.ini file for it and mark the primary key columns). If you wanted to find all authors for a certain book you would just do: index.php?-action=list&-table=book_authors_maillist&book_id=10 So you could easily create an action in the actions.ini file that would like to the mail action on the book_authors_maillist table with the parameters you wanted. e.g.
This action would send mail to only the authors related to the current books. It would be made available in the icons in the upper right on the related list view of only the authors of a book. Mail MergeThe 'Embed Macro' shown above the email form lists the fields which may be included in the email. Say you have a field called 'email_firstname'. You would type this into the message area like this: %email_firstname% When the email is sent, this is substituted for the record of that recipient. Eg. Dear %email_firstname% would be received by email as Dear Tom If the particular record of the field you are merging is blank, then (in this case) the first name will not be shown. blog comments powered by Disqus |