Not able to send attachment with the email


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Not able to send attachment with the email
# 1  
Old 02-18-2014
Not able to send attachment with the email

Hi All,
The below code is working fine for me.
Code:
 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.

Code:
uuencode /path/s1.csv | mailx -s hello abc@xyz.com <<EOT

Hello !!!

How are you?PFA for the file.

Regards
Rahul

EOT

# 2  
Old 02-18-2014
Try :

Code:
cat >msg<<EOT
Hello !!!

How are you?PFA for the file.

Regards
Rahul
EOT


$ ( cat msg ; uuencode /path/s1.csv ) | mailx -s hello abc@xyz.com

# 3  
Old 02-18-2014
How??
Please show the full syntax

---------- Post updated at 11:56 AM ---------- Previous update was at 11:53 AM ----------

Quote:
Originally Posted by Akshay Hegde
Try :

Code:
cat >msg<<EOT
Hello !!!

How are you?PFA for the file.

Regards
Rahul
EOT


$ ( cat msg ; uuencode /path/s1.csv ) | mailx -s hello abc@xyz.com

SYNTAX ERROR

Code:
./mail_test.sh: line 11: syntax error near unexpected token `cat'
./mail_test.sh: line 11: `$ ( cat msg ; uuencode /arbor/fx1/rraj/s1.csv ) | mailx -s hello abc@xyz.com'

# 4  
Old 02-18-2014
Did you try along with $ ? I used $ to indicate terminal, for subject field if you put double quotes its well and good.
# 5  
Old 02-18-2014
Quote:
Originally Posted by Akshay Hegde
Did you try along with $ ? I used $ to indicate terminal, for subject field if you put double quotes its well and good.
Can you please show the example by modifying my code.
# 6  
Old 02-18-2014
On terminal

Code:
cat >msg<<EOF
your msg
EOF

Code:
(cat msg; uuencode  path/to/your/attachement/file) | mailx -s "Your Subject" abc@xyz.com

OR

Code:
cat <<EOF | ( cat -; uuencode  path/to/your/attachement/file) | mailx -s "Your Subject" abc@xyz.com
your msg
EOF

This User Gave Thanks to Akshay Hegde For This Post:
# 7  
Old 02-18-2014
Quote:
Originally Posted by Akshay Hegde
On terminal

Code:
cat >msg<<EOF
your msg
EOF

Code:
(cat msg; uuencode  path/to/your/attachement/file) | mailx -s "Your Subject" abc@xyz.com

OR

Code:
cat <<EOF | ( cat -; uuencode  path/to/your/attachement/file) | mailx -s "Your Subject" abc@xyz.com
your msg
EOF


Yes got it thanks.

Can you also show me an example of sending 2 csv files s1.csv and s2.csv.
I mean in a script as i want to automate the process.This is my first time with mailx commandSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to send email HTML + PDF attachment?

I am attempting to write a script where I can pass in parameters ( to , from, the location of a pdf attachment ) and send an email that has HTML for the body content and a PDF as an attachment. I have failed to achieve this with sendmail and mutt. I recently found this. If there are any... (2 Replies)
Discussion started by: jvsrvcs
2 Replies

2. Shell Programming and Scripting

Send a file through email using cron as an attachment

Hi All, I want to send a file as an attachment through cron job.Is this possible using cronjob nd if it i, can you please let me know how to do this? Thanks (2 Replies)
Discussion started by: NARESH1302
2 Replies

3. UNIX for Advanced & Expert Users

How to send email as HTML format with attachment ?

hi.. Could somebody help me how to sent an attachment using sendmail command and the content is HTML format ?. Below is my code to sent the email as HTML but i do not know how to sent the attachment, please help me To: "BAHARIN HASAN"<baharin.hasan@gmail.com> from: "DATAONE SDN... (4 Replies)
Discussion started by: bh_hensem
4 Replies

4. UNIX for Dummies Questions & Answers

How to send email attachment as read only in Linux

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

5. Shell Programming and Scripting

unable to send an email attachment

i know its pretty repeated query, but i need to post it in this new thread coz i need it urgently uuencode /var/tmp/chandra/emaillist.txt emaillist.txt | mail -s "message with encoded attachment" am unable to send the attachment emaillist.txt present in the path /var/tmp/chandra/ Is... (11 Replies)
Discussion started by: cmaroju
11 Replies

6. Shell Programming and Scripting

how to send an email with some body content and attachment

hi plz help me in sending a mail with some data in body and an attachment as some txt file. currently i am able to send mail with some body content, i need an example how to send the same along with attachment. thanks in advance -bali (2 Replies)
Discussion started by: balireddy_77
2 Replies

7. AIX

Send email from unix (AIX) with PDF attachment

I am using the following command to send PDF attachment with a mail. uuencode <attachment.pdf> <attachment.pdf>|mailx -s <subject> <mail_id> < <Message_file.txt> This one send the message with attachment. I would like send PDF attachment with the mail Can any one help with this issue ? ... (0 Replies)
Discussion started by: sunjup
0 Replies

8. Shell Programming and Scripting

Send email with attachment in form of excel in unix

Hi, I have a shell script which send email with an attachment in the form of an email. However, the when I open the attachment, all the data comes in one column. How do I format the data in the excel sheet while sending the email? Thanks (8 Replies)
Discussion started by: bdebroy
8 Replies

9. Shell Programming and Scripting

send email from unix with attachment

Hello All, This is a common question that I found lot of results in the forums. I am trying to use uuencode to attach a file and send email. I have no issues sending email, but not able to attach any files using sendmail. Is uuencode part of sendmail or does 'uuencode' utility need to be... (1 Reply)
Discussion started by: chiru_h
1 Replies

10. Shell Programming and Scripting

script that will send and email attachment

I'm looking for a sample of some code that will take the output from a file and generate an email that will include that text as an attachment. the script is in the borne shell. any help? (2 Replies)
Discussion started by: davels
2 Replies
Login or Register to Ask a Question