Sending zip file as attachments in perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sending zip file as attachments in perl
# 8  
Old 08-11-2011
don't put ` back quotes inside the system function,
just try below line,
Code:
system ("mutt -a $LOGDIR asak@gmail.com < /dev/null");

---------- Post updated at 12:23 AM ---------- Previous update was at 12:16 AM ----------

Quote:
Originally Posted by asak
HI Latika,

i tried using system command with ` quotes. i got same error.
Code:
Error sending message, child exited 67 (User unknown.).

Below is my standalone script to send file(filer.txt)
Code:
$LOGDIR="/home/user3/filer.txt";

$email = "asak@gmail.com";
#$a = `sudo echo | mutt -a $LOGDIR arunak@netapp.com < /dev/null`;
system (`mutt -a $LOGDIR asak@gmail.com < /dev/null`);
#system ("sh mutt -a $LOGDIR asak@gmail.com < /dev/null");
#my $cmd = "echo mutt -a $LOGDIR asak@gmail.com < /dev/null";
#my $check_ps = `$cmd`;

is there are any other way to send mail with attachments, without installing modules.

Thanks,
Asak

Hi Asak,

dont put ` back quotes inside the system function,
just use below line,
Code:
 system("mutt -a $LOGDIR asak@gmail.com < /dev/null");

# 9  
Old 08-11-2011
Code:
 
system(qq(mutt -a $LOGDIR asak@gmail.com < /dev/null));

# 10  
Old 08-11-2011
Hi latika & itkamaraj

i tried using system, same error i'm getting
Code:
Error sending message, child exited 67 (User unknown.).
Could not send the message.

i think, mutt cannot be run from script, in command line it works fine, any solution other than this. it'll be very helpful...

Thanks,
Asak
# 11  
Old 08-11-2011
Try this...

system(qq(mutt -a $LOGDIR asak@gmail.com) < /dev/null);
# 12  
Old 08-11-2011
HI itkamaraj,

i tried both the ways, this
Code:
system(qq(mutt -a $LOGDIR asak@gmail.com) < /dev/null);

will results in syntax error
Code:
Bareword found where operator expected at att.pl line 2, near "/dev/null"
        (Missing operator before null?)
syntax error at att.pl line 2, near "/dev/null"
Execution of att.pl aborted due to compilation errors.

and executing
Code:
system(qq(mutt -a $LOGDIR asak@gmail.com < /dev/null));

will results in same error :
Code:
Error sending message, child exited 67 (User unknown.).
Could not send the message.

Any other ways??? ?

regards,
Asak
# 13  
Old 08-11-2011
Code:
open( MUTT , "mutt -a $LOGDIR asak@gmail.com) < /dev/null |" );
close( MUTT );

or you can use exec() method
# 14  
Old 08-11-2011
can u try the uuencode command to send a attachment.

Code:
system("uuencode file.zip file.zip | mailx -s subject emailid");

in uuencode command, filename needs to place two times.
i think this ll solve ur problem
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sending attachments via unix

OS Linux....Just curious as to why this is not working... uuencode test.txt "test.xls"|mailx -r xxx@server.com -s "validation report" emailrecipient1,emailrecipient2 Please help....Any other options do we need to use?? (3 Replies)
Discussion started by: saggiboy10
3 Replies

2. Shell Programming and Scripting

Sending Multiple Attachments using MAILX

I have created a shell scripts and wanted to email users multiple attachments using mailx. I noticed that when I do a man on mailx I see and -a option for attachments. When I run a: mailx -s "test attachments" -a include_file -a exclude_file testuser@mydomain.com (Interrupt -- one more to... (1 Reply)
Discussion started by: metallica1973
1 Replies

3. Shell Programming and Scripting

Problem sending excel attachments with MIME::Lite in perl

I am running a perl script that generates an excel doc and then emails it as an attachment. I can generate the excel file fine. I can scp it from the box and open it with no problems. When I send it over email, the file does open properly. The file in email is only 288 B, but on the server it is... (1 Reply)
Discussion started by: Mike_the_Man
1 Replies

4. UNIX for Dummies Questions & Answers

Sending email attachments

Hello, I've search the forum, but I cannot find an answer to my specific question. I'm trying to send some files to my professor. Upon his request, I used the following: tar -cvf vh.tar vh_part1.c vh_part2.c vh_part3.c vh_part4.c vh_sample_run15.txt uuencode vh.tar vh.tar > proj1 mail... (2 Replies)
Discussion started by: venush
2 Replies

5. Shell Programming and Scripting

Sending multiple attachments

Hi people, I am new to this forums. I have a quick question I hope one of you could help me with. I am writing a script to send attachments via email. However I am having trouble when trying to send multiple attachments. Here is the code I am using: send_mail() { uuencode $TMP $TMP1 > $TMP1... (1 Reply)
Discussion started by: deo2k8
1 Replies

6. Shell Programming and Scripting

Sending text files as attachments

Hi, I have used the following command to send a text file "archiver.log" as attachment. (cat mail.log; uuencode archiver.log archiver.log; ) | mailx -s "Failure" asd@a.com : But in the mail i am not getting new lines in the text file.New Lines are getting replaced with some weird... (2 Replies)
Discussion started by: radhika03
2 Replies

7. UNIX for Dummies Questions & Answers

sending attachments in mail

Hi , i have tried the following command to send an email with an attachment its working fine but i am getting mail with the embeded content inside the mail that too truncated. i wanted it as an attachment. /usr/lib/sendmail -F "MAC SIA" address "rajendra@abc.com.sg" -t <... (6 Replies)
Discussion started by: rajendragora
6 Replies

8. UNIX for Advanced & Expert Users

sending attachments via unix

Hi, I need to send a mail attachment from the UNIX commandline. I'm using Tru64 and the mail client thats supposed receive the attached file (an excel sheet) is Lotus Notes. Can anybody help me out? (6 Replies)
Discussion started by: Abhishek Ghose
6 Replies

9. How do I send email?

sending files as attachments

How do I send a file as an attachment on a Unix system (9 Replies)
Discussion started by: SmartJuniorUnix
9 Replies

10. UNIX for Dummies Questions & Answers

sending files as attachments

How do I send a file as an attachment on a Unix system (9 Replies)
Discussion started by: SmartJuniorUnix
9 Replies
Login or Register to Ask a Question