in reply to mail2sms for Kannel
Hello
I'd like to thank everyone who helped in this small project... last year I managed to make it working..
small issue am having is that currently am only able to send sms only to the 1st email that is in the TO header of the mail, I want to be able to send more then 1 sms in case I have more..
Current code:
use strict; use warnings; use Mail::Header; use LWP::UserAgent; use HTTP::Request; use Mail::Internet; use URI::Encode; my $internet = Mail::Internet->new(\*STDIN); my $header_object = $internet->head; my $to = $header_object->get('To'); my $username = substr($header_object->get('To'), 0, index( +$header_object->get('To'), '@')); my $from = $header_object->get('From'); my $subject = $header_object->get('Subject'); $internet->tidy_body; my $linebody = $internet->body; my $body = join("", @$linebody); my $uri = URI::Encode->new( { encode_reserved => 1 } ); $subject = $uri->encode($subject); $username = $uri->encode($username); $body = $uri->encode($body); my $ua = new LWP::UserAgent; $ua->timeout(120); { my $url="http://example.com:14013/cgi-bin/sendsms?username=user&passwo +rd=pass&to=$username&from=mail2sms&text=$subject%0A$body"; my $request = new HTTP::Request('GET', $url); my $response = $ua->request($request); my $content = $response->content(); }
URL For Single SMS: http://example.com:14013/cgi-bin/sendsms?username=user&password=pass&to=$username&from=mail2sms&text=$subject%0A$body
URL For Multiple SMS: http://example.com:14013/cgi-bin/sendsms?username=user&password=pass&to=number1+number2+number3&from=mail2sms&text=$subject%0A$body
Basically the difference is the "+" between the numbers in the "to"
Thanks
|
|---|