Software Support Documentation
@Mail SMS Guide
@Mail System Documentation : v 5.0
The latest version of this file can be found at:
http://support.atmail.com/

 

@Mail SMS Guide


1. What is the SMS module?

The SMS module is the part of @Mail which sends messages through a network provider to mobile phones capable of receiving SMS messages. It allows users to compose SMS messages via the WebMail interface, and define Email to SMS alerts for messages that match a certain filter ( Subject, From, and Prioirty fields )

2. How does the SMS module work?

The SQL module requires the use of the MySQL database back-end for @Mail. It uses SQL tables for SMS Credit and Purchasing details. The flat-file database is unsupported.

The SMS module can be used in two ways.

1: Users purchasing SMS credits via the User Settings panel.

2: The allocation of SMS credits by an Administrator using the WebAdmin control panel.

2.1 User SMS credit system

SMS Credit System

To purchase SMS Credits, open the Utilities folder, select the SMS Utilities, click on the My SMS Credit tab, fill in the details and click on Purchase. An alert will be displayed notifying you if the purchase of your SMS Credits was successful.

2.2 WebAdmin SMS credit Allocation

To allocate credits to your users, open the WebAdmin Interface, click the 'Users' menu then click 'Edit Users', scroll down to the bottom to the form to the SMS Credit Details.

SMS Allocation

Type in the amount of SMS Credits you wish to allocate to the user, then click on save.

3. How can I charge users different prices for SMS messages?


When the users purchases SMS credits they use a form in the SMS Utilities section. The pricing section of the form looks like this:

SMS Prices

You can alter the prices of the SMS credits you are providing your users by editing the template files:

lang/html/xp/smsfilter.htm ( SMS template for the Advanced Interface)

lang/html/simple/smsfilter.html ( SMS template for the Simple Interface)

lang/html/blue_pane/smsfilter.html ( SMS template for the Professional Interface)

The pricing is based on a HTML select box in the format:

<select class=select name="SMSPrice">
<option value="10:2"><font class="sw">$lang{lang_xp_sms_purchase_price_10}</font></option>
<option value="20:3"><font class="sw">$lang{lang_xp_sms_purchase_price_20}</font></option>
<option value="50:6"><font class="sw">$lang{lang_xp_sms_purchase_price_50}</font></option>
<option value="100:8"><font class="sw">$lang{lang_xp_sms_purchase_price_100}</font></option>
</select>

By modifying the above HTML code, you can charge users a different rate for SMS messages. The select box contains the field value [number-of-msgs]:[price], which determines the number of SMS messages and the price for the credits.

3.1 How do I integrate @Mail with my billing gateway?

@Mail provides the framework by which you can charge users for SMS services. The software is setup to verify user-credit card via a mathematical checksum, if valid the details are stored in the SQL database and the users account credited for SMS messages. Integration with the system and your billing provider is required for charging your user credit-cards in realtime (e.g iBill, CCbill, etc).

The following code is used to create the SMS/billing framework in @Mail.

atmaildir/sms.pl

sub purchasesms {

my($product, $price) = split( ":", $atmail->param('SMSPrice') );

my $bill = new Atmail::Billing(
Account => "$atmail->{username}\@$atmail->{pop3host}",
CardNumber => $atmail->param('CardNumber'),
CardName => $atmail->param('CardName'),
CardExpMonth => $atmail->param('CardExpMonth'),
CardExpYear => $atmail->param('CardExpYear'),
Service => "$product SMS blocks"
);

$bill->makepayment();

if($bill->{PaymentStatus} == 1) {

$bill->createuser();
$bill->createpayment();

$sms->addcredit($product);

return "Transaction successful. $product SMS credits added to your account";

} else {

return "Transaction unsuccessful"; }

}

atmaildir/libs/Atmail/Billing.pm:

sub makepayment {
my ($self) = @_;

# Add the actual credit-card authorization integration here

if($self->cc_validate($self->{CardNumber}) == 1) {
# 1 is successful
$self->{PaymentStatus} = 1;
} else {
$self->{PaymentStatus} = 0;
}

return;
}

4. Database layout

Provided is the database layout that you can use as a guide to integrating the SMS module into your billing system.

# TABLE FOR CREDITCARD PAYMENTS

CREATE TABLE ClientBilling (
Account varchar(64) DEFAULT '' NOT NULL,
CardNumber varchar(64),
CardName varchar(64),
CardExpMonth varchar(4),
CardExpYear varchar(4),
PaymentStatus tinyint(4),
DateSignup datetime,
DatePaid datetime,
Amount mediumint(8) unsigned,
id mediumint(8) unsigned DEFAULT '0' NOT NULL auto_increment,
Service varchar(32),
PRIMARY KEY (id)
);

# TABLE FOR SMS CREDITS

CREATE TABLE SMSCredits (
Account varchar(128),
Credit mediumint(8) unsigned DEFAULT '0' NOT NULL,
id mediumint(8) unsigned DEFAULT '0' NOT NULL auto_increment,
PRIMARY KEY (id)
);

# LOG DATABASE FOR ALL OUTGOING SMS MESSAGES

CREATE TABLE SMSsent (
Account varchar(128) DEFAULT '' NOT NULL,
SMSFrom varchar(128),
SMSTo varchar(128),
SMSStatus varchar(8),
SMSmessage varchar(255),
id mediumint(8) unsigned DEFAULT '0' NOT NULL auto_increment,
SMSid varchar(64),
SMSdate datetime,
PRIMARY KEY (id),
KEY iAccount (Account)
);

An sql query result from the SMSCredits table:

mysql> select * from SMSCredits;
+-----------------------+--------+----+
| Account               | Credit | id |
+-----------------------+--------+----+
| dan@service.net       | 9      | 1  |
| user@service.net      | 5      | 2  |
| johns@service.net     | 10     | 3  |
| ben@service.net       | 100    | 4  |
+-----------------------+--------+----+

5. Troubleshooting

  1. Why does the SMS module not work?
    Verify you have purchased a block of SMS messages from Calacode before using the SMS utility. All SMS messages sent via your @Mail installation are sent to the Calacode network for delivery to a user phone. If your software DownloadID does not have any SMS messages allocated the system will fail.

  2. Why don't my messages send, even when I have available credits?
    You have tried to send an SMS message to a carrier is not covered by our supporting network. Check the network availability site at:  http://atmail.com/index.ehtml?p=cover&b=8 . If the network is listed, verify you have correctly specified the recipient mobile-phone ( Remove any leading 0's from the number )

6 Related Article

Browse related articles from our online Knowledge-base regarding the SMS Module

7. Contact Support

For additional support, please visit our web site, http://atmail.com/ . Or send us an eMail : support@CalaCode.com

877-4-ATMAIL (Sales) +1 773-451-8334 (USA) +61 245-730745 (Australia)

home | email server | webmail client | email appliance | antivirus | anti spam | groupware | secure email | email admin | email sms | purchase | FAQ | support | KB | Blog | sitemap