Skip to main content

SMTP email to SMS gateway

SMTP to SMS gateway

Here is one way to build yourself an SMTP to SMS gateway.

Description
Requirements
Installation

Description

This is a very simple way to build yourself a small scale SMTP to SMS gateway, to allow you to send emails to your mobile phone.

Requirements

· Old mobile phone with a pre-paid phone card, so you won't end up with a nasty bill.



· Data cable



· Phone charger



· Linux PC (Pentium 120Mhz with 32MB RAM)



· Gnokii http://www.gnokii.org/

Installation

Connect your phone to COM1 (/dev/ttyS0) using your data cable.

Download and install Gnokii.





 su -
 rpm -ivh ftp://ftp.gnokii.org/pub/gnokii/binaries/RedHat/gnokii-0.4.3-1.i386.rpm
 rpm -ql gnokii # List files
 more /usr/share/doc/gnokii-0.4.3/COPYING
 more /usr/share/doc/gnokii-0.4.3/CREDITS
 more /usr/share/doc/gnokii-0.4.3/README
 cp /usr/share/doc/gnokii-0.4.3/gnokiirc ~/.gnokiirc
 vi ~/.gnokiirc
 # set "model = " to suite your phone
 # set "connection = " to suite your cable
 # in my case I set
 # "model = 7110" 
 # "connection = dau9p"
 # and had to comment out "require_dcd = 1"
 # Now test that gnokii can find your phone
 gnokii --monitor
 # send yourself an SMS
 echo "Test SMS message" | gnokii --sendsms [your mobile number]
 
Example POP3 to SMS Perl script





 #!/usr/bin/perl
 use Net::POP3;
 my $mail_server="mailserver";
 my $username="username";
 my $password="password";
 my $phoneNumber="phonenumber";
 my $gnokii = "|/usr/bin/gnokii --sendsms $phoneNumber";
 my $pop = Net::POP3->new($mail_server)
 or die "Can't open connection to $mail_server : $!n";
 defined ($pop->login($username, $password))
 or die "Can't authenticate: $!n";
 $messages = $pop->list
 or die "Can't get list of undeleted messages: $!n";
 foreach my $msgid (keys %$messages) {
 my $email = $pop->get($msgid);
 unless (defined $email) {
 warn "Couldn't fetch $msgid from server: $!n";
 next;
 }
 my $header=1;
 my $message = "";
 # $message is a reference to an array of lines
 foreach (@$email) {
 if ($_ =~ /^n/ && $header == 1) {
 $header = 0;
 }
 if ($header == 1 &&; /^From:s/) {
 my ($from) = ($_ =~ /([wd.-_]+@[wd.-]+)/);
 $from =~ s/[<>]//g;
 $message .= "Frm $fromn";
 }
 if ($header == 1 && /^Subject:s/) {
 my ($subject) = ($_ =~ s/^Subject:/Sbj/g);
 $message .= "$_";
 }
 if ($header == 0) {
 s/are/R/gi;
 s/you/U/gi;
 s/before/B4/gi;
 s/seesyou/CU/gi;
 # etc, etc.
 $message .= "$_";
 }
 }
 # limit to SMS 160 char limit.
 $message = substr($message, 0, 160);
 # send this message
 open(GNOKII, $gnokii) or die "$0: Could not open $gnokiin";
 print GNOKII $message;
 close GNOKII;
 # mark message to be deleted at quit below
 $pop->delete($msgid);
 }
 $pop->quit($mail_server);
 exit 0;
 


Comments

Popular posts from this blog

Sewa Ruang Meeting Daerah Citarum Bandung

Sewa ruang meeting kantor, training di Bandung Hubungi 0816-4038-78. Lokasi Ruang Meeting berada di Jl.Pelajar Pejuang 45 No.23B 1. Paket per Jam      - Biaya : Rp.50.000 / org / jam     - Fasilitas : Snack & Drink 2. Paket Half-Day     - Waktu : 09.00 s/d 13.00 Wib     - Biaya : Rp.120.000 / org      - Fasilitas : Makan siang 1x, Snack & Drink 3. Paket Full Day     - Waktu : 09.00 s/d 16.00 Wib     - Biaya : Rp.170.000 / org      - Fasilitas : Makan siang 1x, Coffe break 2x, Snack & Drink 4. Lain-lain     - Sewa Proyektor : Rp.150.000/day     - Extra time : Rp.100.000/Jam Syarat dan Ketentuan : 1. Min. 3org dan Max. 7org 2. Pembayaran H-3 sebelum tgl pelaksanaan 3. Melebihi jam ketentuan dikenakan biaya tambahan Sewa Ruang Meeting Daerah Citarum Bandung Hubungi 0816-4038-78 Ruang meeting murah mulai 50.000 di Buah Batu, Pasteur, Sukajadi, Lengkong, Antapani, Uj...

Palangkaraya Pijat Panggilan 24 Jam ke Rumah, Hotel , Apartemen

via IFTTT