Installation &
Operations Guide
SSA Fetchmail
Version 1.0
23.08.2009
Installation & Operations Guide
Table of Contents
Product Description......................................................................................................3
Installation and Configuration......................................................................................5
Requirements............................................................................................................5
Installation................................................................................................................6
SSAfetchmail Configuration.......................................................................................7
Database Configuration............................................................................................9
Operations.................................................................................................................11
How to Start ssafetchmail.......................................................................................11
How to Stop ssafetchmail........................................................................................11
How to Check that ssafetchmail run........................................................................11
How to Add an Email ISP account into ssafetchmail ...............................................11
Confidential Page 2 8/24/2009
Installation & Operations Guide
Product Description
SSA Fetchmail ( Basic version ) is a multi-threaded solution that allows the
notifications of all the new emails arrived to ISP external Email Accounts. Just email
retrieved by the SSA Fetchmail, SSA Fetchmail delivers the emails or part of the
emails to the end subscribers via three different channels: Email, SMS and Local SQL
repository.
The following figure depicts how SSA Fetchmail Solution works.
SSA fetchmail consists of only 1 process and a Mysql Database where the Email
accounts data configuration is saved. According to that configuration SSA fetchmail
(Basic version ) uses four retriever modules and three deliver modules:
The retriever modules are:
1. Retriever for POP3 Email accounts
Confidential Page 3 8/24/2009
Installation & Operations Guide
2. Retriever for POP3 SSL Email accounts
3. Retriever for IMAP4 Email accounts
4. Retriever for IMAP4 SSL Email accounts
Example of ISP with Email accounts that have been tested during the IOT are:
Gmail (POP SSL)
HotPop (POP)
Terra (POP)
Terra (IMAP)
AOL (IMAP)
Gmx (IMAP)
Gmx (IMAP SSL)
Fastmail (IMAP)
The deliver modules are:
1. Deliver module for SMTP interface.
2. Deliver module for SMS SMPP interface.
3. Deliver module for Local SQL – Filesystem.
Confidential Page 4 8/24/2009
Installation & Operations Guide
Installation and Configuration
SSAFetchmail solution is provided in a tar file named ssafetchmail.xx.1.0.tar.gz
Requirements
1. OS where SSAFetchmail has been tested in:
CentOS 5.2
Fedora 10
Ubuntu 9
RHEL 4
2. Check that the following software is installed prior the ssafetchmail
installation:
CentOS 5.2:
glibc-2.5-34.el5_3.1
mysql-5.0.45-7.el5
mysql-server-5.0.45-7.el5
openssl-0.9.8e-7.el5
zlib-1.2.3-3
krb5-libs-1.6.1-31.el5_3.3
e2fsprogs-libs-1.39-20.el5
keyutils-libs-1.2-1.el5
libselinux-1.33.4-5.1.el5
libsepol-1.15.2-1.el5
Fedora 10
glibc-2.9-3.i686
mysql-libs-5.0.77-1.fc10.i386
mysql-server-5.0.77-1.fc10.i386
mysql-5.0.77-1.fc10.i386
openssl-0.9.8g-13.fc10.i686
Confidential Page 5 8/24/2009
Installation & Operations Guide
zlib-1.2.3-18.fc9.i386
krb5-libs-1.6.3-18.fc10.i386
e2fsprogs-libs-1.41.4-5.fc10.i386
keyutils-libs-1.2-3.fc9.i386
libselinux-2.0.78-1.fc10.i386
Ubuntu 9
sudo apt-get install mysql-server
sudo apt-get install openssl
sudo apt-get install libmysql++-dev
sudo apt-get install libssl-dev
Installation
1. Put file ssafetchmail.xx.1.0.tar.gz in directory /opt.
2. Uncompress and untar filename ssafetchmail.xx.1.0.tar.gz
# tar xzvf ssafetchmail.xx.1.0.tar.gz
3. Check that the following directories have been created:
/opt/ssafetchmail/bin:
Directory that contains the executable file ssafetchmaild.
/opt/ssafetchmail/logs:
Directory that contains the log files of ssafetchmaild
/opt/ssafetchmail/etc:
Directory that contains the configuration file main.cfg of ssafetchmaild.
This file will be described in the following chapter.
/opt/ssafetchmail/ssa_mbox:
Directory where Emails retrieved will be sabed when the configuration
option “Local_Delivery” of an Email account has been enable.
Confidential Page 6 8/24/2009
Installation & Operations Guide
/opt/ssafetchmail/scripts:
Directory that contains scripts to start and stop the process fetchmail.
SSAfetchmail Configuration
1. Go to Directory /opt/ssafetchmail/etc.
2. Edit file main.cfg.
3. Set the parameter general.debug; General.debug enable the DEBUG if set to
1.
general.debug = 0
4. Set the parameter timeoutsocket; timeoutsocket is the timeout for
connections from the ssafetchmail to the ISP Servers and SMTP sever.
timeoutsocket = 120
5. Set the parameter maxthreads; maxthreads is the number of threads to be
running. More threads running more accounts review speed, but more
memory and CPU required
maxthreads = 20
6. Set the parameter pollingtimeperaccount ; pollingtimeperaccount is the
minimal interval in seconds that a ISP email accounts can be analysed if new
emails has arrived.
pollingtimeperaccount = 1
7. Set the parameter dbase; dbase is the Mysql to be used by ssafetchmaild.
dbase = fetchdb
8. Set the parameter dbuser; dbuser is the Mysql user used by ssafetchmaild.
dbuser = home
Confidential Page 7 8/24/2009
Installation & Operations Guide
9. Set the parameter dbpass; dbpass is the Mysql password used by
ssafetchmaild
dbpass = home
10. Set the parameter dbhost ; dbhost is the host where the Mysql database
used by ssafetchmail runs.
dbhost = localhost
11. Set the parameter dbport ; dbport is the port where the Mysql database used
by ssafetchmail listens
dbport = 3306
12. Set the parameter dbunixport ; dbunixport is the unix port where the Mysql
database used by ssafetchmail listens. It must be the same value that appears
in parameter socket of file /etc/my.cnf
dbunixport = /var/lib/mysql/mysql.sock
13. Set the parameter smtpserver ; smtpserver is the EMAIL server used to
deliver via SMTP TLS the messages retrieved.
smtpserver = mail.securenet-sistavan.com
14. Set the parameter smtpport; smtpport is the EMAIL server port used to
deliver via SMTP TLS the messages retrieved
smtpport = 587
15. Set the parameter helodomainname; helodomainname is the EHLO domain
used in the SMTP TLS communication
helodomainname = localdomain.es
16. Set the parameter emailaccount; emailaccount is the EMAIL account used to
deliver via SMTP TLS the messages retrieved
emailaccount = [email protected]
17. Set the parameter emailuser ; emailuser is the EMAIL user used to deliver via
SMTP TLS the messages retrieved
emailuser = [email protected]
Confidential Page 8 8/24/2009
Installation & Operations Guide
18. Set the parameter emailpassword ; emailpassword is the EMAIL password
used to deliver via SMTP TLS the messages retrieved
emailpassword = xxxxxxx
19. Set the parameter smscserver ; smscserver is the SMSC host used to deliver
via SMS SMPP the messages retrieved.
Smscserver = 127.0.0.1
20. Set the parameter smscport ; smscport is the SMSC port used to deliver via
SMS SMPP the messages retrieved
smscport = 16000
21. Set the following SMSC SMPP parameters:
system_id = admin
system_password = admin
system_type = esme
ton = 0x01
npi = 0x02
service_type =
src_addr = 12345
For SMS test you can download a SMSC simulator from:
http://opensmpp.logica.com/CommonPart/Download/download2.html#simulator
To run the simulator:
# java -cp smpp.jar:smscsim.jar com.logica.smscsim.Simulator
Database Configuration
1. Start Database
/etc/rc.d/init.d/mysqld start
or
cd /usr ; /usr/bin/mysqld_safe &
or in Ubuntu
sudo /etc/init.d/mysql start
Confidential Page 9 8/24/2009
Installation & Operations Guide
2. Go to Directory /opt/ssafetchmail/scripts
3. Run Database script
mysql -h localhost -u root < ./installDB.sql
or
mysql -h localhost -u root -p < ./installDB.sql
4. Check that Database has been created
scripts]# mysql -h localhost -u home -p
Password: home
> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| fetchdb |
| mysql |
| test |
+--------------------+
> use fetchdb;
> show tables;
+-------------------+
| Tables_in_fetchdb |
+-------------------+
| accounts |
| imap_uids |
| mbox |
| pop_uidls |
+-------------------+
Note: The script installDB.sql has created several dummy Email accounts so you will
see error in the Log about them. They are coming from our tests.
Confidential Page 10 8/24/2009
Installation & Operations Guide
Operations
How to Start ssafetchmail
# cd /opt/ssafetchmail/scripts
# ./start.sh
or
# cd cd /opt/ssafetchmail/bin
# nohup ./ssafetchmaild &
How to Stop ssafetchmail
# cd /opt/ssafetchmail/scripts
# ./stop.sh
How to Check that ssafetchmail run
1. ps -ef | grep ssafetchmail
./ssafetchmaild
2. Review the log
cd /opt/ssafetchmail/logs and see that triggerd.log has the following 2 messages
[24/08/2009 09:26:40.387159] info: config initialized successfully
[24/08/2009 09:26:40.404882] info: STARTING ... Thread Safe ON
How to Add an Email ISP account into ssafetchmail
Confidential Page 11 8/24/2009
Installation & Operations Guide
mysql -h localhost -u home -p
home
> use fetchdb;
Insert Entries in Table Account:
Columns:
1. id. Unique identifier of the ISP Email Account.
2. subscriber: Name of the Subscriber that can have several Ids.
3. server: Hostname of the POP, POPSSL, IMAP or IMAP SSL Server where
Email will be retrieved from.
4. port: port of the POP, POPSSL, IMAP or IMAP SSL Server where Email
will be retrieved from. ( Usually 110 for POP, 995 for POPSSL, 143 for IMAP, 993 for
IMAP SSL )
5. user: user of the Email account.
6. pass: Password of the Email account
7. protocol: imap or imapssl or pop or popssl
8. local_delivery if 'yes', messages retrieved will be saved in table 'mbox' and
directory ../ssa_mbox
9. smtp_delivery: if 'yes', messages retrieved will be sent to the Email account set
in column smtp_account
10. smpp_delivery: if 'yes' , messages retrieved will be sent to the MSISDN set in
column smpp_msisdn.
Examples:
Confidential Page 12 8/24/2009
Installation & Operations Guide
For IMAP
> use fetchdb;
> INSERT INTO `accounts` (`id`, `subscriber`, `server`, `port`, `user`, `pass`,
`protocol`, `timeframe`, `mailbox`, `local_delivery`, `smtp_delivery`,
`smpp_delivery`, `smtp_account`, `smpp_msisdn`) VALUES (2, 'a02',
'mail.messagingengine.com',143,'
[email protected]','dxxxxxx','imap',0,'0','
yes','yes','yes','
[email protected]','629506455');
for POP
> use fetchdb;
> INSERT INTO `accounts` (`id`, `subscriber`, `server`, `port`, `user`, `pass`,
`protocol`, `timeframe`, `mailbox`, `local_delivery`, `smtp_delivery`,
`smpp_delivery`, `smtp_account`, `smpp_msisdn`) VALUES ( 3, 'a03',
'pop.hotpop.com', 110, '
[email protected]', 'dxxxxxx', 'pop', 0, '0', 'yes',
'yes', 'yes', '
[email protected]', '629506455');
for POPSSL
> use fetchdb;
> INSERT INTO `accounts` (`id`, `subscriber`, `server`, `port`, `user`, `pass`,
`protocol`, `timeframe`, `mailbox`, `local_delivery`, `smtp_delivery`,
`smpp_delivery`, `smtp_account`, `smpp_msisdn`) VALUES ( 4, 'a04',
'pop.gmail.com', 995, 'emailuser.dom', 'dxxxxx', 'popssl', 0 , '0', 'yes', 'yes', 'yes',
'
[email protected]', '629506455');
For IMAPSSL
> use fetchdb;
> INSERT INTO `accounts` (`id`, `subscriber`, `server`, `port`, `user`, `pass`,
`protocol`, `timeframe`, `mailbox`, `local_delivery`, `smtp_delivery`,
`smpp_delivery`, `smtp_account`, `smpp_msisdn`) VALUES ( 1, 'account01',
Confidential Page 13 8/24/2009
Installation & Operations Guide
'imap.gmx.com', 993, '[email protected]', 'qxxxx', 'imapssl', 0, '0', 'yes', 'yes',
'yes', '
[email protected]', '629506455');
Check that in Logs the following messages appears:
[24/08/2009 09:47:38.217395] info: Id 1 Thread 6 Account Process Started
[24/08/2009 09:47:39.081779] info: Id 1 Account Process Finished
Now the the internal mailbox has been set and new emails arriving to the ISP email
account will be delivered.
Send an email to the Account provisioned and if a new email arrived:
1. if smtp_delivery is set to 'yes' , you will see a Log Message like this:
[24/08/2009 09:57:53.994632] info: Id 1 EMAIL message delivered successfully to
h
[email protected] 2. if smpp_delivery is set to 'yes' , you will see a Log Message like this:
[24/08/2009 09:57:53.995295] info: Id 1 MSISDN 629506455 SMS You have an email from
[email protected]. Subject: test 1
3. if local_delivery is set to 'yes' , you will see a new entry in table mbox and in
Directory /opt/ssafetchmail/ssa_mbox/
File ${id}/${id}_timestamp
Note: for any additional question, please send us an email to
[email protected]Confidential Page 14 8/24/2009