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


In reply to Re: mail2sms for Kannel by Pizu
in thread mail2sms for Kannel by Pizu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.