Saturday, 11 May 2013

Create Your Own Maillist Manager using the Xataface Email Module


Suppose you have a "contacts" table in your database that contains contact information of all of your customers or users.  It is probable that you intend to contact these by email - e.g. for a mailing list.  The Xataface Email module makes it a simple matter to use this table as a mailing list.

What it Does

The Email module adds a "Send Email" action to all designated tables that allows you to send email to all records in the current found set.

Features

  • HTML Email
  • Attachments
  • Email templates
  • Compatible with all existing found sets.  (E.g. you can perform a search for any subset of rows, and the module will send to the found set).

Prerequisites

Installation

  1. Create a modules directory inside your application's directory, if it doesn't exist already:

    $ cd /path/to/my/app
    $ mkdir modules
  2. Check out the latest SVN trunk of the ckeditor module into the modules directory:

    $ cd modules
    $ svn co http://weblite.ca/svn/dataface/modules/ckeditor/trunk ckeditor
  3. Check out the latest SVN trunk of the Email module into the modules directory

    $ svn co http://weblite.ca/svn/dataface/modules/Email/trunk Email
  4. Activate both the ckeditor and Email modules in the conf.ini file by adding the following to the [_modules] section:

    modules_ckeditor=modules/ckeditor/ckeditor.php
    modules_Email=modules/Email/Email.php
  5. Designate the tables on which you want the "Send Email" action to be available by marking them as implementing the Person ontology.  You do this by adding the following to the beginning of the fields.ini file of each table that should be designated:

    [__implements__]
        Person=1
  6. In addition, you may need to specify which field of the table contains the email address.  You do this by adding the email=1 directive to the field's definition in the fields.ini file.  E.g:

    [my_email_field]
        email=1


    If you don't do this, Xataface will have to try and guess which field to use - and it may be wrong!

Enabling Attachments

If you want to be able to send attachments with your email messages,  you will need to follow these additional installation steps:
  1. Install the ajax_upload module.  You can do this by navigating to the modules directory, and checking out the latest from SVN:

    $ cd modules
    $ svn co http://weblite.ca/svn/dataface/modules/ajax_upload/trunk ajax_upload
  2. Enable the ajax_upload module in your conf.ini file by adding the following to the [_modules] section:

    modules_ajax_upload=modules/ajax_upload/ajax_upload.php
  3. Specify the location of the directory to store the uploaded files, by adding the following to your conf.ini file:

    [modules_Email]
        attachments=path/to/attachments
        attachments_url=url/to/attachments

Sending Email

Now that we have the module installed, let's try to send some email.  In our example application, I have a "contacts" table with all of my contacts.
The "List" view for the contacts table.  Notice the "Send Email" button, which is present because the Email module is installed and the contacts table is designated as a "Person" entity.

You can see from the result descriptor in the upper right that the current found set has 1155 records.  If you want to send an email to all 1155 contacts, just click the "Send Email" button at the top.  This will open the email form:
The email form.  The Message body uses CKeditor to allow you to craft an HTML email in WYSIWYG fashion.


Before proceeding with sending the email, you should double check that you are sending to the found set that you intend.  Look at the description at the top of the form that says "Please complete the form below to send email to the 1155 email addresses...", and ensure that the number looks right.  You should also click the "Show Email Addresses" link to reveal a list of the email addresses that will be mailed.  The worst thing you can do is accidentally send an email to thousands of people.
If you accidentally click "Send", you can still cancel or pause the email queue at any time - so there are some fail safes in place.

So let's send a simple email to all of our found set:
A simple email by filling in the subject, from, and message body fields.  Notice that the "From" field should include the email address in the standard email notation: Name <address>.
Now that we're ready, click the "Send Now" button:
This will show an email progress form to allow you to track the progress of the mailout:

You can cancel/pause the mailout at any time by clicking the "Cancel" button.  Clicking this button will take you to a "Job Paused" screen:
You can resume the job by clicking "Resume Job", and you can also view the mail log to see a detailed log of all of the email that has already been sent (by clicking "View Mail Log"):
The email history log shows every email that has been sent, along with status information about the Email.


In my example email here, it sent out 96 emails successfully before I paused it.  Logging into my email program, I can view the email:
The resulting email as opened in my Email reader

Opting Out of the Mail List

Notice that the mailer automatically added a line at the bottom of the email to give the recipient the option to "Opt out" of the mailing list.  This "opt-out" feature is built into the Email module and is handled automatically for you.  The module keeps a "black list" of email addresses that should not receive email.  When a batch email is created, it automatically skips any recipient addresses on this black list (unless you explicitly tell the Email module to ignore the black list on the email form).

Just to see what happens, I'm going to click on the link to opt out:

Form to opt out of receiving email notifications

This form gives the user an opportunity to reconsider opting out.  If they are sure that they don't want to receive email from this list, they can click the button on this form.  

They can opt back in at any time by clicking the same link that is in the email.

Customizing the Opt-Out Instructions

In some cases you might not want the user to see this opt-out message, or you may want to customize it to fit your purposes.  This can be done using either a conf.ini  file directive or a delegate class method.  For this example, let's just use the conf.ini file directives.  You can simply add the following section, and sub-directives to your conf.ini file:

opt_out_html = "<hr/><p>Click <a href='$url'>here</a> to opt out of our list.</p>"
opt_out_text = "\r\n\r\n----------------------\r\n To opt out, go to $url \r\n"

You can specify any text you want here.  Just embed the $url variable in the content where you want the link to the opt-out page to appear.

12 comments:

  1. Great post,thanks for sharing this useful information.In recent era, for the advertising and marketing of any new or old business there is one effective and low costly way used that is email marketing. Purchasing email lists or buying them from email lists for sale will be very beneficial for your business. This will increase the revenue and reputation of your company in market.

    ReplyDelete
    Replies
    1. Hi everyone I'm Olivia Hannah and am here to share the wonderful work Dr Raypower did for me. After 5 years in marriage with my husband with 2 kids, my husband started acting weird and going out with other ladies and showed me cold love, on several occasions he threatens to divorce me if I dare question him about his affair with other ladies, I was totally devastated and confused until a old friend of mine told me about a spell caster on the internet called Dr. Raypower who help people with relationship and marriage problem by the powers of love spells, at first I doubted if such thing ever exists but decided to give it a try, when I contact him, he helped me cast a love spell and within 48hours my husband came back to me and started apologizing, now he has stopped going out with other ladies and his with me for good and for real. Contact this great love spell caster for your relationship or marriage problem to be solved today via email: Urgentspellcast@gmail.com or Urgentspellcast@yahoo.com or Call or WhatsApp: +14243308109. 

      Read more about him on his website: http://urgentspellcast.website2.me/

















      Hi everyone I'm Olivia Hannah and am here to share the wonderful work Dr Raypower did for me. After 5 years in marriage with my husband with 2 kids, my husband started acting weird and going out with other ladies and showed me cold love, on several occasions he threatens to divorce me if I dare question him about his affair with other ladies, I was totally devastated and confused until a old friend of mine told me about a spell caster on the internet called Dr. Raypower who help people with relationship and marriage problem by the powers of love spells, at first I doubted if such thing ever exists but decided to give it a try, when I contact him, he helped me cast a love spell and within 48hours my husband came back to me and started apologizing, now he has stopped going out with other ladies and his with me for good and for real. Contact this great love spell caster for your relationship or marriage problem to be solved today via email: Urgentspellcast@gmail.com or Urgentspellcast@yahoo.com or Call or WhatsApp: +14243308109. 

      Read more about him on his website: http://urgentspellcast.website2.me/

      Delete
    2. I want to let everyone here know that Spell casting really works. However it wouldn't have been possible for me to get my ex back without the kind support and help of Dr Larry, whose his Website: http://assurancesolutioncenter.website2.me/ i would like to extend my golden sincere thanks to Dr Larry who helped me to get my ex back. i want to thank  this great spell caster who is so powerful and good in spell casting. I am highly indebted to Dr Larry for his help in getting my ex back. My boyfriend left me for another girl, i was so heart broken so i contacted a friend who introduced me to the great Dr Larry who have helped her before to get her boyfriend back so i did all he asked me to do. Surprisingly 48 hours later as he promised my boyfriend called me and asked me to forgive him, we are back together living happily. Don't let anybody to deceive you spell casting works. Contact him through his website: http://assurancesolutioncenter.website2.me/ and Email: assurancesolutionhome@gmail.com. Whatsapp +1(424)-261-8520 thank you so much sir   http://assurancesolutioncenter.over-blog.com  







      I want to let everyone here know that Spell casting really works. However it wouldn't have been possible for me to get my ex back without the kind support and help of Dr Larry, whose his Website: http://assurancesolutioncenter.website2.me/ i would like to extend my golden sincere thanks to Dr Larry who helped me to get my ex back. i want to thank  this great spell caster who is so powerful and good in spell casting. I am highly indebted to Dr Larry for his help in getting my ex back. My boyfriend left me for another girl, i was so heart broken so i contacted a friend who introduced me to the great Dr Larry who have helped her before to get her boyfriend back so i did all he asked me to do. Surprisingly 48 hours later as he promised my boyfriend called me and asked me to forgive him, we are back together living happily. Don't let anybody to deceive you spell casting works. Contact him through his website: http://assurancesolutioncenter.website2.me/ and Email: assurancesolutionhome@gmail.com. Whatsapp +1(424)-261-8520 thank you so much sir   http://assurancesolutioncenter.over-blog.com  

      Delete
  2. I saw this post. It is full of information. This post was very nice to me. I hope everyone will be better. Thanks for sharing.

    email lists for sale

    ReplyDelete
  3. TeethNightGuard is selling precise fitting and high quality custom made teeth guards.

    ReplyDelete
  4. When you have aggregated an email rundown and remember this can comprise of thousands or possibly simply several dozen, you can begin promoting yourself productively. email on deck

    ReplyDelete
  5. Quantum Binary Signals

    Get professional trading signals sent to your mobile phone every day.

    Start following our signals NOW & profit up to 270% per day.

    ReplyDelete
  6. I wanted to say that I have loved this blog.Very informative post with lots of information included in the posting.
    You have made some really good points here ! You might also be interested to know more about generating more leads and getting the right intelligence to engage prospects.E-Health Care Lists implements new lead gen ideas and strategies for generating more leads and targeting the right leads and accounts.E-Health Care Lists is one of the global suppliers of healthcare mailing list & email list.Marketing to the healthcare industry, reaching the doctors and other healthcare decision makers is often an impossibletask.Please refer to
    Purchasing Director Mailing list & Email list

    ReplyDelete
  7. If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you need to watch this video
    right away...

    (VIDEO) Want your ex CRAWLING back to you...?

    ReplyDelete
  8. Hello i am here to spread this good news to the entire world on how i got my ex love back.I was going crazy when my love left me for another girl last month,But when i meet a friend that introduce me to DR IROSI the great messenger to the oracle that he serve,I narrated my problem to DR IROSI about how my ex love left me and also how i needed to get a job in a very big company.He only said to me that i have come to the right place were i will be getting my heart desire without any side effect.He told me what i need to do,After it was been done,In the next 2 days,My love called me on the phone and was saying sorry for living me before now and also in the next one week after my love called me to be pleading for forgiveness,I was called for interview in my desired company were i needed to work as the managing director..I am so happy and overwhelmed that i have to tell this to the entire world to contact DR IROSI at the following email address DRIROSISOLUTIONCENTER@GMAIL.COM and get all your problem solve..No problem is too big for him to solve..Contact him direct on DRIROSISOLUTIONCENTER@GMAIL.COM or call his mobile number or add him up on whatsapp via (+2348118829771). and get your problems solve like me.    

    ReplyDelete
  9. LOVE SPELLS THAT WORKS I am sharing this testimony to partners suffering in their relationships because there is an enduring solution.
    My husband left me and our 2 kids for another woman for 3 years. I tried to be strong just for my kids but I could not control the pains that torment my heart. I was hurt and confused. I needed a help, so i did a research on the internet and came across a site where I saw that Dr. Aluya a spell caster, can help get lovers back. I contacted him and he did a special prayer and spells for me. To my surprises, after some days, my husband came back home. That was how we reunited again and there was a lot of love, joy and peace in the family.
    You can as well contact Dr.  Aluya  , a powerful spell-caster for solutions on his contact aluya.48hoursspelltemple@gmail.com or directly on Whats App: +2348055431163 

    ReplyDelete
  10. I want to let everyone here know that Spell casting really works. However it wouldn't have been possible for me to get my ex back without the kind support and help of Dr Larry, whose his Website: http://assurancesolutioncenter.website2.me/ i would like to extend my golden sincere thanks to Dr Larry who helped me to get my ex back. i want to thank  this great spell caster who is so powerful and good in spell casting. I am highly indebted to Dr Larry for his help in getting my ex back. My boyfriend left me for another girl, i was so heart broken so i contacted a friend who introduced me to the great Dr Larry who have helped her before to get her boyfriend back so i did all he asked me to do. Surprisingly 48 hours later as he promised my boyfriend called me and asked me to forgive him, we are back together living happily. Don't let anybody to deceive you spell casting works. Contact him through his website: http://assurancesolutioncenter.website2.me/ and Email: assurancesolutionhome@gmail.com. Whatsapp +1(424)-261-8520 thank you so much sir   http://assurancesolutioncenter.over-blog.com  







    I want to let everyone here know that Spell casting really works. However it wouldn't have been possible for me to get my ex back without the kind support and help of Dr Larry, whose his Website: http://assurancesolutioncenter.website2.me/ i would like to extend my golden sincere thanks to Dr Larry who helped me to get my ex back. i want to thank  this great spell caster who is so powerful and good in spell casting. I am highly indebted to Dr Larry for his help in getting my ex back. My boyfriend left me for another girl, i was so heart broken so i contacted a friend who introduced me to the great Dr Larry who have helped her before to get her boyfriend back so i did all he asked me to do. Surprisingly 48 hours later as he promised my boyfriend called me and asked me to forgive him, we are back together living happily. Don't let anybody to deceive you spell casting works. Contact him through his website: http://assurancesolutioncenter.website2.me/ and Email: assurancesolutionhome@gmail.com. Whatsapp +1(424)-261-8520 thank you so much sir   http://assurancesolutioncenter.over-blog.com  

    ReplyDelete