08-31-2009
Modify Perl Script To Send Attachments
Hello,
I'm a newbie to the world of programming and so i decided to take up perl. I'm trying to learn how to modify the script below in order to have it sent with attachments. Any suggestions?
#!/usr/bin/perl -w
use strict;
use warnings;
my $from = 'xxx@domain.com';
my $to = 'xxx@domain.com';
my $cc = 'xxx@domain.com';
my $from = 'xxx@domain.com';
my $subj = 'Testing';
my $body = 'TEST';
open my $pipe, '|-','/usr/bin/mailx', '-s',$subj, '-c', $cc, $to, "-f$from",
or die "can't open pipe to mailx: $!\n";
print $pipe $body ;
close $pipe;
die "mailx exited with a non-zero status: $?\n" if $?;
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have this code, and i want work with a ls -shalR output in .txt
What i need read to do this??
Where start?
#!/usr/bin/perl
# Allrights- A perl tool for making backups of file permissions
# Copyright (C) 2005 Norbert Klein <norbert@acodedb.com>
# This program is free... (1 Reply)
Discussion started by: joangopan
1 Replies
2. Shell Programming and Scripting
Hello all !I have two sets of folders that have IP address from two sources.The below perl script I was working with needs some corrections.I am looking for the perl script to identify and count what IP address are found to be duplicated between both files.The format from both files are the same... (4 Replies)
Discussion started by: richsark
4 Replies
3. UNIX for Advanced & Expert Users
Hi All,
I have a requirement to send and email of body html with an attachment.
concatinating uuencode output to the mail body with mailx command works, but as my Email body is of HTML type i use sendmail.
my command to send HTML body is as below:
export MAILTO="recipient@domain.com"... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies
4. Shell Programming and Scripting
Hello,
does somebody can make script for me, which replace:
ąćę
ąćę
ąćę
(input file)
to
ace;|;ąćę
ace;|;ąćę
ace;|;ąćę
(output file) (3 Replies)
Discussion started by: Xadrian
3 Replies
5. UNIX for Dummies Questions & Answers
Dear Members,
I am trying to send a file as an attachment from the command prompt in Linux.
I am using the following:
(echo "Find attached Exception Report"; uuencode $DATA_TOP/out/data/$err_rpt_file $err_rpt_file)|/bin/mailx -s "***Exceptions Found" davidk@xyz.com Here err_rpt_file... (2 Replies)
Discussion started by: sandeep_1105
2 Replies
6. Shell Programming and Scripting
Hello ,
I am trying to send an email with two attachments . I have tried all previous suggestion in this forum but none worked. I could send one attachment in an email by
uuencode $file "$file" | mailx -m -s "File" xxx@xx.com
but unable to send multiple attachments .
I have tried
... (8 Replies)
Discussion started by: RaviTej
8 Replies
7. Red Hat
We don't have uuencode installed in our machines..... Please tell me how to send mail with multiple attachments ??? URGENT !!!!!
Please tell me using command line (or) scripts..........
please......
Thanks in Advance.... (1 Reply)
Discussion started by: vamshigvk475
1 Replies
8. Shell Programming and Scripting
Hi Friends,
I want to convert a csv file into a ordinary .txt file. I am able to convert but I want the output to look as shown below in the .txt file
table findhost=
{
{"xyz","abc"},
{"rxz","mmz"},
{"vrr","nnz"},
}
default={"NONE"}
My current perl script
#!/usr/bin/env perl... (12 Replies)
Discussion started by: dbashyam
12 Replies
9. UNIX for Advanced & Expert Users
I am trying to send a mail alongwith attachments in hpux server. Its not throwing any error but it seems the command is still running,neither its sending the mail. The commands i am using is-
uuencode 00PZ00000012OHJMA2.csv | mailx -s "Hello" abc@hp.com
uuencode Shell_Script_Sample.ksh |... (1 Reply)
Discussion started by: saga20
1 Replies
10. Shell Programming and Scripting
Hi,
i try to send two (multiple) files by the mail-console-command
mail -s TEST -a f1.pdf f2.pdf n.ame@ms123.de
but it doesn't work. can someone give me a hint?
Thanks in advance,
IMPe (2 Replies)
Discussion started by: IMPe
2 Replies
LEARN ABOUT DEBIAN
poe::pipe::twoway
POE::Pipe::TwoWay(3pm) User Contributed Perl Documentation POE::Pipe::TwoWay(3pm)
NAME
POE::Pipe::TwoWay - a portable API for two-way pipes
SYNOPSIS
my ($a_read, $a_write, $b_read, $b_write) = POE::Pipe::TwoWay->new();
die "couldn't create a pipe: $!" unless defined $a_read;
DESCRIPTION
Pipes are troublesome beasts because there are a few different, incompatible ways to create them, and many operating systems implement some
subset of them. Therefore it's impossible to rely on a particular method for their creation.
POE::Pipe::TwoWay will attempt to create a bidirectional pipe using an appropriate method. If that fails, it will fall back to some other
means until success or all methods have been exhausted. Some operating systems require certain exceptions, which are hardcoded into the
library.
The upshot of all this is that an application can use POE::Pipe::TwoWay to create a bidirectional pipe without worrying about the mechanism
that works in the current run-time environment.
By the way, POE::Pipe::TwoWay doesn't use POE internally, so it may be used in stand-alone applications without POE.
PUBLIC METHODS
new [TYPE]
Create a new two-way pipe, optionally constraining it to a particular TYPE of pipe. Two-way pipes have two ends, both of which can be read
from and written to. Therefore, a successful new() call will return four handles: read and write for one end, and read and write for the
other. On failure, new() sets $! to describe the error and returns nothing.
my ($a_read, $a_write, $b_read, $b_write) = POE::Pipe::TwoWay->new();
die $! unless defined $a_read;
TYPE may be one of "pipe", "socketpair", or "inet". When set, POE::Pipe::TwoWay will constrain its search to either "pipe()", a UNIX-
domain "socketpair()", or plain old sockets, respectively. Otherwise new() will try each method in order, or a particular method
predetermined to be the best one for the current operating environment.
BUGS
POE::Pipe::OneWay may block up to one second on some systems if failure occurs while trying to create "inet" sockets.
SEE ALSO
POE::Pipe, POE::Pipe::OneWay.
AUTHOR & COPYRIGHT
POE::Pipe::TwoWay is copyright 2000-2008 by Rocco Caputo. All rights reserved. POE::Pipe::TwoWay is free software; you may redistribute
it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-05-15 POE::Pipe::TwoWay(3pm)