Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hello all :)

I managed to do some good progress.. :)

1 #!/usr/bin/perl -w 2 use strict; 3 use warnings; 4 use Mail::Header; 5 use LWP::UserAgent; 6 use HTTP::Request; 7 use Email::Simple; 8 9 my @liste = (<>); 10 my $header_object = new Mail::Header \@liste, Modify => 0, MailFro +m => "COERCE" ; 11 12 my $to = $header_object->get('To'); 13 my $username = substr($header_object->get('To'), 0, index +($header_object->get('To'), '@')); 14 my $apparently_from = $header_object->get('Return-Path'); 15 my $from = $header_object->get('From'); 16 my $mail_from = $header_object->get('Mail-From'); 17 my $subject = $header_object->get('Subject'); 18 19 20 21 my $email_details = new Email::Simple; 22 23 my $body = $email_details->get('Body'); 24 25 /* Printing to file - testing */ 26 27 my $filename = '/var/scripts/log/mail2sms.txt'; 28 open(my $fh, '>', $filename) or die "Could not open file '$filenam +e' $!"; 29 30 print $fh ' To: ' . $to; 31 print $fh ' From: ' . $from; 32 print $fh ' maybe From: ' . $apparently_from; 33 print $fh ' Subject: ' . $subject; 34 print $fh ' Username: ' . $username; 35 print $fh ' mbox From: ' . (split(/\s+/,$mail_from))[0]; 36 print $fh ' Body: ' . $body; 37 print $fh $/; 38 39 40 41 my $ua = new LWP::UserAgent; 42 $ua->timeout(120); 43 #my $result = `ps -e | grep -v grep|grep smsbox |awk \'{print \$1} +\'`; 44 #my $result = true; 45 46 #if ( $result ne "" ) 47 { 48 my $url="http://x.x.x.x:14013/cgi-bin/sendsms?username=kanneluser& +password=kannelpassword&to=$username&from=mail2sms&text=$subject $bod +y"; 49 my $request = new HTTP::Request('GET', $url); 50 my $response = $ua->request($request); 51 my $content = $response->content(); 52 }

My Issue is this now, Lines: 21,23 is not working, can someone help me?

also for the body, is it possible to make it as a single string?


In reply to Re^2: 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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-18 05:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found