[lug] file handle and pipe
Hugh Brown
hugh at vecna.com
Wed Jul 3 13:23:41 MDT 2002
On Sat, 2002-06-29 at 00:18, j davis wrote:
>
> so my friend was just a little off in syntax
>
> this.....
> open MAIL, "|/usr/sbin/sendmail jd\@taproot.bz";
> print MAIL "$in{content}";
> close MAIL;
>
> should be.....
> open(MAIL, "|/usr/sbin/sendmail jd\@taproot.bz");
> print MAIL "$in{content}";
> close MAIL;
>
> just had to stare at it a while...like i said im new to perl. Piping
> into a program is cool, can all programs with a command line interface
> be piped into in this manner?
>
If the program accepts input on STDIN then you can use perl to open it
that way. I'd suggest getting the O'Reilly books Learning Perl and the
camel book as resources. Use Learning Perl to work through a few
examples and use the camel book as a reference.
FWIW,
Hugh
>
> thanks,
> jd
>
>
>
>
> >From: "j davis" <davis_compz at hotmail.com>
> >Reply-To: lug at lug.boulder.co.us
> >To: lug at lug.boulder.co.us
> >Subject: Re: [lug] file handle and pipe
> >Date: Sat, 29 Jun 2002 03:52:29 +0000
> >MIME-Version: 1.0
> >X-Originating-IP: [209.155.171.204]
> >Received: from community.tummy.com ([66.54.152.73]) by hotmail.com with
> >Microsoft SMTPSVC(5.0.2195.4905); Fri, 28 Jun 2002 20:54:02 -0700
> >Received: (qmail 19805 invoked by uid 0); 29 Jun 2002 03:54:59 -0000
> >Received: from localhost (HELO community.tummy.com)
> >(?poQUcm16T+gbLgERZ4pJ1mnpg9RX0eMC?@127.0.0.1) by localhost with SMTP; 29
> >Jun 2002 03:54:45 -0000
> >Received: (qmail 19649 invoked by alias); 29 Jun 2002 03:53:01 -0000
> >Received: (qmail 19638 invoked by uid 0); 29 Jun 2002 03:52:55 -0000
> >Received: from f208.law10.hotmail.com (HELO hotmail.com) (64.4.15.208) by
> >community.tummy.com with SMTP; 29 Jun 2002 03:52:52 -0000
> >Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
> >Fri, 28 Jun 2002 20:52:29 -0700
> >Received: from 209.155.171.204 by lw10fd.law10.hotmail.msn.com with
> >HTTP;Sat, 29 Jun 2002 03:52:29 GMT
> >Return-Path: <alias-blug_dom-lug-owner at lug.boulder.co.us>
> >Delivered-To: mailman-lists.lug.boulder.co.us-lug at lists.lug.boulder.co.us
> >Delivered-To: alias-blug_dom-lug at lug.boulder.co.us
> >Message-ID: <F208qwNAJrFFfWcmU9J000014b6 at hotmail.com>
> >X-OriginalArrivalTime: 29 Jun 2002 03:52:29.0797 (UTC)
> >FILETIME=[640FD950:01C21F20]
> >Sender: lug-admin at lug.boulder.co.us
> >Errors-To: lug-admin at lug.boulder.co.us
> >X-BeenThere: lug at lug.boulder.co.us
> >X-Mailman-Version: 2.0.11
> >Precedence: bulk
> >List-Help: <mailto:lug-request at lug.boulder.co.us?subject=help>
> >List-Post: <mailto:lug at lug.boulder.co.us>
> >List-Subscribe:
> ><http://lists.lug.boulder.co.us/mailman/listinfo/lug>,<mailto:lug-request at lug.boulder.co.us?subject=subscribe>
> >List-Id: Boulder (Colorado) Linux Users Group -- General Mailing List
> ><lug.lug.boulder.co.us>
> >List-Unsubscribe:
> ><http://lists.lug.boulder.co.us/mailman/listinfo/lug>,<mailto:lug-request at lug.boulder.co.us?subject=unsubscribe>
> >List-Archive: <http://lists.lug.boulder.co.us/pipermail/lug/>
> >
> >
> >I'm sorry I should be more clear. My var is from a perl script and I
> >would like to stay that way. When i try this...
> >
> >`/bin/echo $in{content} | sendmail jd\@taproot.bz`;
> > or
> >`/bin/echo $in{content} | mail -s "Subject..." jd\@taproot.bz`;
> >
> >the mail gets there just not the contents.
> >
> >?,
> >jd
> >
> >
> >
> >
> >>From: Mark Horning <rip6 at rip6.net>
> >>Reply-To: lug at lug.boulder.co.us
> >>To: lug at lug.boulder.co.us
> >>Subject: Re: [lug] file handle and pipe
> >>Date: Fri, 28 Jun 2002 19:24:11 -0600
> >>MIME-Version: 1.0
> >>Received: from [66.54.152.73] by hotmail.com (3.2) with ESMTP id
> >>MHotMailBEE657F8001B4004325E4236984907500; Fri, 28 Jun 2002 18:27:20 -0700
> >>Received: (qmail 17740 invoked by uid 0); 29 Jun 2002 01:26:56 -0000
> >>Received: from localhost (HELO community.tummy.com)
> >>(?UEo2xa/WU9ooFr3wAowETiDysfI/pFyU?@127.0.0.1) by localhost with SMTP; 29
> >>Jun 2002 01:26:48 -0000
> >>Received: (qmail 17568 invoked by alias); 29 Jun 2002 01:24:50 -0000
> >>Received: (qmail 17565 invoked by uid 0); 29 Jun 2002 01:24:39 -0000
> >>Received: from 12-254-25-186.client.attbi.com (12.254.25.186) by
> >>community.tummy.com with SMTP; 29 Jun 2002 01:24:37 -0000
> >>Received: from rip6.net (telecaster.rip6.net [192.168.1.10])by
> >>12-254-25-186.client.attbi.com (8.11.6/8.11.6) with ESMTP id
> >>g5T1OB125144for <lug at lug.boulder.co.us>; Fri, 28 Jun 2002 19:24:11 -0600
> >>From lug-admin at lug.boulder.co.us Fri, 28 Jun 2002 18:29:01 -0700
> >>Return-Path: <alias-blug_dom-lug-owner at lug.boulder.co.us>
> >>Delivered-To: mailman-lists.lug.boulder.co.us-lug at lists.lug.boulder.co.us
> >>Delivered-To: alias-blug_dom-lug at lug.boulder.co.us
> >>Message-ID: <3D1D0C3B.30902 at rip6.net>
> >>User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4.1)
> >>Gecko/20020508 Netscape6/6.2.3
> >>X-Accept-Language: en-us
> >>References: <F87k4Kgwb7o0ISQuAwt000012cd at hotmail.com>
> >><1025311759.1151.1.camel at eddy>
> >>Sender: lug-admin at lug.boulder.co.us
> >>Errors-To: lug-admin at lug.boulder.co.us
> >>X-BeenThere: lug at lug.boulder.co.us
> >>X-Mailman-Version: 2.0.11
> >>Precedence: bulk
> >>List-Help: <mailto:lug-request at lug.boulder.co.us?subject=help>
> >>List-Post: <mailto:lug at lug.boulder.co.us>
> >>List-Subscribe:
> >><http://lists.lug.boulder.co.us/mailman/listinfo/lug>,<mailto:lug-request at lug.boulder.co.us?subject=subscribe>
> >>List-Id: Boulder (Colorado) Linux Users Group -- General Mailing List
> >><lug.lug.boulder.co.us>
> >>List-Unsubscribe:
> >><http://lists.lug.boulder.co.us/mailman/listinfo/lug>,<mailto:lug-request at lug.boulder.co.us?subject=unsubscribe>
> >>List-Archive: <http://lists.lug.boulder.co.us/pipermail/lug/>
> >>
> >>
> >>
> >>Ed Hill wrote:
> >>
> >>>On Fri, 2002-06-28 at 17:37, j davis wrote:
> >>>
> >>>>Hello,
> >>>>Im a newbie. I have a var. that holds the contents of a email. I am
> >>>>trying
> >>>>to send the email using sendmail like this....
> >>>>
> >>>>`/bin/echo $in{content} | sendmail jd\@taproot.bz`;
> >>>>
> >>>
> >>>How about:
> >>>
> >>> /bin/echo $in{content} | mail -s "Subject..." jd\@taproot.bz
> >>>
> >>>hth,
> >>>Ed
> >>>
> >>
> >>Or try something like this as a function in a shell script:
> >>mail () {
> >> (
> >> echo "To: jd at taproot.bz"
> >> echo -e "Subject: some subject\n"
> >> echo $in{content}
> >> ) | /usr/lib/sendmail -t
> >>}
> >>
> >>or from the command line:
> >>(/bin/echo "To: jd at taproot.bz";/bin/echo -e "Subject: some
> >>subject\n";/bin/echo "$in{content}") | /usr/lib/sendmail -t
> >>
> >>
> >>--
> >>
> >>Mark Horning
> >>rip6 at rip6.net
> >>
> >>
> >>
> >>_______________________________________________
> >>Web Page: http://lug.boulder.co.us
> >>Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> >>Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
> >
> >
> >thanks,
> >jd
> >
> >jd at taproot.bz
> >http://www.taproot.bz
> >
> >_________________________________________________________________
> >Send and receive Hotmail on your mobile device: http://mobile.msn.com
> >
> >_______________________________________________
> >Web Page: http://lug.boulder.co.us
> >Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> >Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>
>
> thanks,
> jd
>
> jd at taproot.bz
> http://www.taproot.bz
>
> _________________________________________________________________
> Join the worlds largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
>
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
More information about the LUG
mailing list