Info2SMS

<< Click to display Table of Contents >>

Navigation:  Interfaces > Info2Mail >

Info2SMS

In various urgent situations, it sometimes is necessary that certain usergroups need to be notified via SMS.

Most SMS providers offer a SMTP gateway which converts incoming e-mails to SMS. Cordaware bestinformed can also use the SMTP gateway of those SMS providers.

 

In order to set up the Info2SMS interface, proceed as follows:

 

1.) (Optional) Create a password container which contains the the credentials for the SMTP server. If no authentification is required this step can be skipped.

 

2.) Create a new Info2Mail filter and use the operator "script.is_info2mail" is not empty.

 

Info2Sms_FilterEN

 

3.) Add the folowing script and edit it according to your needs.

 


-module(info2mail).

-export([main/1]).

 

main(_) ->

 

  %%%-------------------------------------------------------------------

  %%% CONFIGURATION

  %%%-------------------------------------------------------------------

 

  %% Enter the SMTP server of your provider here.

  Relay = "",

 

  %% Enter the port used to communicate with the SMTP server.

  Port = 25,

 

  %% Enter your login name here, which you use to register with your mail provider.

  UsernameOrEmail = "",

 

  %% Enter your password into the Cordaware bestinformed password vault.

  %% Then enter here the alias of your password that you have defined in the password vault.

  PasswordAlias = "",

 

  %% Specify here whether you need to authenticate with your mail provider:

  %%  * true  = Authentication required

  %%  * false = Authentication not required

  Auth = false,

 

  %% Set your desired encryption method here. The following values are possible:

  %%  * tls  = TLS encryption

  %%  * ssl  = SSL encryption

  %%  * none = No encryption

  Secure = tls,

 

  %% Enter the mail addresses of the desired recipients here.

  %% Multiple recipients can be specified in a comma-separated list.

  %% Make sure that NO comma is added after the last recipient!

  %% Note: Some SMS gateways require that a list is transmitted as the recipient in the following syntax:

  %%  * "<mobile number>@<gateway>"

  To = [

    "recipient_1@mail.com",

    "recipient_2@mail.com"

  ],

 

  %% Enter the mail address of the sender here.

  From = "sender@mail.com",

 

  %% Enter the keys / cell phone numbers of the recipients here.

  Subject = "Key1, Key2",

 

  %%%-------------------------------------------------------------------

  %%% INTERNAL FUNCTIONS

  %%%-------------------------------------------------------------------

 

  Mail = [

    {relay, Relay},

    {port, Port},

    {username, UsernameOrEmail},

    {password, PasswordAlias},

    {auth, Auth},

    {secure, Secure},

    {to, To},

    {from, From},

    {debug, fun(TO) -> best_script:debug_msg("Send email to: ~p", [TO]) end},

    {subject, Subject},

    {body, best_script:info()},

    {content_type, html}

  ],

  best_script:sendmail(Mail, []),

  true.

 

Afterwards you can save your filter and use the filter as a recipient in the infoeditor.