Active Members Fi8sVrs Posted April 19, 2012 Active Members Report Posted April 19, 2012 DescriptionThis 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. RequirementsOld mobile phone with a pre-paid phone card, so you won't end up with a nasty bill.http://www.e-things.org/smtp2sms/images/mobile_phone.pngData cablehttp://www.e-things.org/smtp2sms/images/phone_cable.pngPhone chargerhttp://www.e-things.org/smtp2sms/images/phone_charger.pngLinux PC (Pentium 120Mhz with 32MB RAM)http://www.e-things.org/smtp2sms/images/pc_486.pngGnokii gnokii.org - Home InstallationConnect 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) = ($_ =~ /([\w\d\.-_]+@[\w\d\.-]+)/); $from =~ s/[\<\>]//g; $message .= "Frm $from\n"; } 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/see\syou/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 $gnokii\n"; print GNOKII $message; close GNOKII; # mark message to be deleted at quit below $pop->delete($msgid); } $pop->quit($mail_server); exit 0;scr Quote