12-04-2008
Thanks to everyone who replied. What happened to my Linux is my root user told me that I need a reboot. After the reboot, then my email with attachment works. Here's my code with a subject, body, and an attachment:
#!/bin/bash
FILE=$1
RECIPIENT=myemail@yahoo.com
(echo "This file $FILE was sent from Linux."
for i in `ls -1 $FILE`
do
file_name=`basename $i`
uuencode $i $file_name
done
) | mail -s "Mail sent with the attachment file: $FILE" "$RECIPIENT"
To use this script, just type in the name of the script followed by the filename. I thought I'd share this because I had a hard time getting to this point
This thread is closed.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
How to send an attachment of which the name contains the space.
Following is the command I tried.
metasend -b -s "test subject" -F "test@yahoo.com" -t "test@test.com" -f "test.txt" -m "text/plain" -n -f "test 123.txt" -m "application/xls"
If the file name contains no space,... (0 Replies)
Discussion started by: egckhad
0 Replies
2. UNIX for Advanced & Expert Users
Hello - In unix, can you tell me IF there is a way to send attachments via email without using uuencode command?
Thank you (3 Replies)
Discussion started by: panchpan
3 Replies
3. Shell Programming and Scripting
Hi,
I want to send a attachment using mailx command and also i want to include body of the mail which is stored in a text file.:confused:
uuencode att.txt att.txt |mailx -s "attachment" adc@mail.com < text.txt
I tried this command, but it is not working fine. It is showing the body but it is... (2 Replies)
Discussion started by: lathish
2 Replies
4. Shell Programming and Scripting
Hi,
I usually write a file TEST.MAIL like this to send mails:
Importance: High
Priority: Urgent
X-Priority: 1 (Highest)
From: user
Subject: error
... text body ....
and then I launch it (or writre a c-chell that launchs it) by writing:
mail a@b.com < /users/.../TEST.MAIL
How can... (4 Replies)
Discussion started by: albaalbetti
4 Replies
5. UNIX for Dummies Questions & Answers
Hi,
Could anyone help me to find soultion for the issue to send email attachment as read only.
I can change the file permission in Linux and can send the email attachment from Linux. But my requirment is user can read the attachment but should not modified it . even user save the attachment... (4 Replies)
Discussion started by: calagar
4 Replies
6. Shell Programming and Scripting
H All
I want to send attachment in mail but I dont have uuencode installed in AIX server,
there is any alternative way to send attachment in mail. (2 Replies)
Discussion started by: ns64110
2 Replies
7. Shell Programming and Scripting
Hi All,
I need to send mail with attachment. I am using uuencode but it seems it is sending encoded file. I am getting the mail with attachment but there is no data even the file size is almost 90KB. Please help.
Thanks. (3 Replies)
Discussion started by: unankix
3 Replies
8. Shell Programming and Scripting
Hi All,
I am trying to send mail via unix and attaching file along with that mail, but facing issue while sending.
I have tried below commands-
1)-
uuencode $prmDirOutput/report_mailbody $prmDirOutput/report_mailbody | mailx -s "Acknowledgment file- $subject" $email_id
2)-
mutt -a... (4 Replies)
Discussion started by: Amit786
4 Replies
9. Shell Programming and Scripting
Hi All,
The below code is working fine for me.
mailx -s hello abc@xyz.com <<EOT
Hello !!!
How are you?
Regards
Rahul
EOT
But i am not able to send csv file with the mail .Getting just themail but not the attachment.
uuencode /path/s1.csv | mailx -s hello abc@xyz.com <<EOT... (9 Replies)
Discussion started by: rafa_fed2
9 Replies
LEARN ABOUT SUSE
mail::mbox::messageparser::perl
Mail::Mbox::MessageParser::Perl(3) User Contributed Perl Documentation Mail::Mbox::MessageParser::Perl(3)
NAME
Mail::Mbox::MessageParser::Perl - A Perl-based mbox folder reader
SYNOPSIS
#!/usr/bin/perl
use Mail::Mbox::MessageParser;
my $filename = 'mail/saved-mail';
my $filehandle = new FileHandle($filename);
my $folder_reader =
new Mail::Mbox::MessageParser( {
'file_name' => $filename,
'file_handle' => $filehandle,
} );
die $folder_reader unless ref $folder_reader;
# Any newlines or such before the start of the first email
my $prologue = $folder_reader->prologue;
print $prologue;
# This is the main loop. It's executed once for each email
while(!$folder_reader->end_of_file());
{
my $email = $folder_reader->read_next_email();
print $email;
}
DESCRIPTION
This module implements a Perl-based mbox folder reader. Users must not instantiate this class directly--use Mail::Mbox::MessageParser
instead. The base MessageParser module will automatically manage the use of faster implementations if they can be used.
METHODS AND FUNCTIONS
The following methods and functions are specific to the Mail::Mbox::MessageParser::Perl package. For additional inherited ones, see the
Mail::Mbox::MessageParser documentation.
$ref = new( { 'file_name' => <mailbox file name>, 'file_handle' => <mailbox file handle> });
<file_name> - The full filename of the mailbox
<file_handle> - An opened file handle for the mailbox
The constructor for the class takes two parameters. The optional file_name parameter is the filename of the mailbox. The required
file_handle argument is the opened file handle to the mailbox.
Returns a reference to a Mail::Mbox::MessageParser object, or a string describing the error.
BUGS
No known bugs.
Contact david@coppit.org for bug reports and suggestions.
AUTHOR
David Coppit <david@coppit.org>.
LICENSE
This software is distributed under the terms of the GPL. See the file "LICENSE" for more information.
HISTORY
This code was originally part of the grepmail distribution. See http://grepmail.sf.net/ for previous versions of grepmail which included
early versions of this code.
SEE ALSO
Mail::Mbox::MessageParser
perl v5.12.1 2009-08-09 Mail::Mbox::MessageParser::Perl(3)