ficonabses

REASONABLY PRODUCTION READY:

DESCRIPTION:

A simple way to send emails from your application using amazon ses. Register at admin.ses.sg.estormtech.com to create your account. Templates can be emails or Apple Push Notifications. APNs require more configuration so please contact estormtech directly to implement this functionality but the same code will send either in your application.

FEATURES/PROBLEMS:

  • A simple way to send text and html emails from your application. Templates for the contents of the email can be configured at admin.ses.sg.estormtech.com.

  • You can send spontaneous emails directly in your code. Or more elegantly you can set up a template on the system and send it with contents inserted in the parameters of the call. That way you can change the template (eg have a different design for Halloween or Eid or Christmas) while not touching your production code.

SYNOPSIS HTML EMAIL:

  • res =FiconabSES::Base.send_htmlemail(‘acccount’,‘password’,‘[email protected]’,‘This is the subject’,‘<h1>HTML Contents</h1><p>hi from paragraph</p>’,‘text contents of the email’)

  • for multiple sends use set_credentials(account,password), then send_html

  • or similarly functionality eg:

    f=FiconabSES::Base.new
    f.set_credentials(,passwd)
    f.send_htmlemail(@destination,'This is the subject','<h1>HTML Contents</h1><p>hi from paragraph</p>','text contents of the email')
    

SYNOPSIS TEXT EMAIL:

  • res =FiconabSES::Base.send_textemail_direct(‘acccount’,‘password’,@destination,‘This is the subject’,‘contents of the email’)

  • or similarly functionality eg:

    f=FiconabSES::Base.new
    f.set_credentials(,passwd)
    f.send_textemail(@destination,'This is the subject','text contents of the email')
    

SYNOPSIS USING A TEMPLATE:

  • The subject and contents of the template are defined on the system. See admin.ses.sg.estormtech.com. As well as a bcc variable is also possible to be defined to automatically copy an addresss. The template may be an email or an apple push notification.

  • res =FiconabSES::Base.send_template_direct(@account,@passwd,@destination,templatename)

  • or similarly using objects

    f=FiconabSES::Base.new
    f.set_credentials(@account,@passwd)
    res =f.send_template(@destination,'testtemplate')
    

SYNOPSIS USING A TEMPLATE PLUS PARAMETERS

  • This allows you to have a dynamic template and fill in the details in the template dynamically. (eg insert url, customer name) into the template just by attaching the values to the call in a ruby hash. If the destination is part of a black list you will receive HTTP Status code 412 (precondition failed)

  • res =FiconabSES::Base.send_template_params_direct(@account,@passwd,@destination,templatename,options)

  • or similarly using objects

    f=FiconabSES::Base.new
    options={}
    options['customername']='Mr Test'  #in the template {customername} will be replaced with Mr Test
    f.set_credentials(@account,@passwd)
    res =f.send_template_params(@destination,'testtemplate',options)
    

SYNOPSIS SENDING RUBY EXCEPTION

  • This allows you mail a ruby exception report directly from your application.

  • res =FiconabSES::Addons.send_exception_direct(@account,@passwd,@destination,exception)

CAMPAIGN FLOWS

  • This allows you structure a sequence of emails/customer interaction based on parameters. (eg you could email the customer something and send them an apple push notification at the same time)

  • Exactly the same calling sequence as for templates.

    f=FiconabSES::Base.new
    options={}
    options['customername']='Mr Test'  #in the template {customername} will be replaced with Mr Test
    f.set_credentials(@account,@passwd)
     res =@f.send_campaign_flow(@destination,'testcampaign',options)
    

BINARY FILES

  • ficonabses_template_test.rb - Send a template to a destination. Type ‘ficonabses_template_test.rb –help’ in a terminal on your cmpueter for more information

  • fionabses_csv.rb - Send the contents of csv file to the system for email broadcash. The file should be in destination,templatename,param1,params2 format with headers. A sample file follows:

sample file:

REQUIREMENTS:

  • httpclient gem and ses.sg.estormtech.com is up and you have an account/password at admin.ses.sg.estormtech.com.

INSTALL:

  • sudo gem install ficonabses httpclient

DEPENDENCY:

  • dependency on httpclient.

TESTS

  • See the tests files attached to the gem or on this website

CAVEATS

  • The parameters need to be passed in as a hash as the code relies on it being a hash to build the URL string.

LICENSE:

(The MIT License)

Copyright © 2011 Estorm Technologies Pte Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.