Sending a mail with different attachment in AIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sending a mail with different attachment in AIX
# 1  
Old 10-13-2015
Sending a mail with different attachment in AIX

How to Send a mail with multiple attachment also differenet extension using uuencode in AIX.

Can you please help me.

---------------------------------------------------------

I have below code. But attachment not been attached.

Code:
(cat /aceapp/QATD011R4/ace.ofac/testofac/results/;uuencode /aceapp/QATD011R4/ace.ofac/testofac/results/*.* *.*) | mail -s "Summary Report" smawle@acesw.com


Last edited by Don Cragun; 10-13-2015 at 08:44 AM.. Reason: Remove request for URGENT help & add CODE tags.
# 2  
Old 10-13-2015
Code:
for i in /aceapp/QATD011R4/ace.ofac/testofac/results/
 do
 uuencode ${i} ${i%.*}.txt
 done > attach.out
  
 mail -s "Summary Report" smawle@acesw.com < attach.out

# 3  
Old 10-13-2015
The given code is sending attachment but in binary format, additionally can we send the contents mentioned in the attached file in mail body too.
# 4  
Old 10-13-2015
If the files are in binary format or if they are encrypted, you can see them in binary...
for example, if you have the extension of a pdf or doc file to txt and try to open it using notepad, you cannot read the text
# 5  
Old 10-13-2015
Thanks Srinishoo.

I am trying below code for attached multiple % summary % csv files in email. However, not able to attached it. Also, we only required Summary files in particular folder.

eg. In result folder 100 csv file we need to fetched only summary file. (SDN_WCFINCEN_summary_20151013_111216.csv)
So, that in code we had mentioned that %summary%.csv

Below are code we are using.

Code:
(cat /aceapp/QATD011R4/ace.ofac/testofac/results/%summary*.*;uuencode /aceapp/QATD011R4/ace.ofac/testofac/results/summary*.* %summary*.*) | mail -s "Summary Report" smawle@acesw.com

Your help is highly appreciated.

Thanks.

Regards,
Swap nil
Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, sample output, AND code segments.

Last edited by Don Cragun; 10-13-2015 at 08:51 AM.. Reason: Add CODE tags.
# 6  
Old 10-13-2015
Quote:
Originally Posted by Swapnil Mawle
Thanks Srinishoo.

I am trying below code for attached multiple % summary % csv files in email. However, not able to attached it. Also, we only required Summary files in particular folder.

eg. In result folder 100 csv file we need to fetched only summary file. (SDN_WCFINCEN_summary_20151013_111216.csv)
So, that in code we had mentioned that %summary%.csv

Below are code we are using.

Code:
(cat /aceapp/QATD011R4/ace.ofac/testofac/results/%summary*.*;uuencode /aceapp/QATD011R4/ace.ofac/testofac/results/summary*.* %summary*.*) | mail -s "Summary Report" smawle@acesw.com

Your help is highly appreciated.

Thanks.

Regards,
Swap nil
Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, sample output, AND code segments.
There are no percent sign characters in the pathname SDN_WCFINCEN_summary_20151013_111216.csv and percent sign characters in a pathname pattern matching expression match literal percent sign characters. It would seem that you want to use something more like:
Code:
pathname=$(printf '%s' /aceapp/QATD011R4/ace.ofac/testofac/results/*summary*.csv)
(cat "$pathname";uuencode "$pathname" "${pathname##*/}") | mail -s "Summary Report" smawle@acesw.com

which will give you plain text and unencoded text in the body of the mail. But, it will only work if there is one and only one file in that directory that contains the string summary and ends with the string .csv.
# 7  
Old 10-13-2015
Thanks Don for your reply.

After ran the code, we have received the plain mail. No attachment in that mail. Also, no text in mail body.

In Result folder we have around 25 csv files out of 8 files belong to Summary CSV files and all these 8 files we need to attached in the mail.

Please help me to solve the problem.

Thanks.

Regards,
Swapnil
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Sending Excel Files as attachment using Mail

Hie, I need to attach an .xlsx file as an attachment to a mail. I have used the mail option but i dont think there is anything for attachment. Can you show me how else can i do it? I am not allowed to install mutt since it is a workplace and they have their restrictions. And its a Bash Shell (2 Replies)
Discussion started by: barryallen
2 Replies

2. How to Post in the The UNIX and Linux Forums

Sending a mail with different attachment in AIX

How to Send a mail with multiple attachment also differenet extension using uuencode in AIX. Can you please help me. Its so urgent. Thanks. Regards, Swapnil ---------- Post updated at 05:37 AM ---------- Previous update was at 05:35 AM ---------- I have below code. But attachment... (1 Reply)
Discussion started by: Swapnil Mawle
1 Replies

3. Shell Programming and Scripting

Need help in sending html mail with attachment

Hi Everyone, I am facing problems in sending html mail with attachemnt. I will able to send mail with attachment (plain text ) using mailx -s and uuencode command and also html mail without attachment using sendmail option. However I am not able to send html mail along with attachment.Either... (2 Replies)
Discussion started by: karthik adiga
2 Replies

4. Shell Programming and Scripting

Problem in sending mail with attachment

Hi Team, I have written the following code snippet to send mail with attachment to recipient. But I am getting mail with attachment. But the file is empty. All the 3 Attachment* size is more than 80KB. Not sure what is wrong in the command. MSG_BODY1="hi" LOG_FILE="a/b/c/log1.log"... (2 Replies)
Discussion started by: kmanivan82
2 Replies

5. UNIX for Advanced & Expert Users

Sending mail with attachment

Hi, I am using Sun solaris OS unix server I am trying to send mail with an attachment using below script cat test.txt;uuencode test.txt test.txt|mailx -s "$subject" someone@somewhere I m getting mails but with no attachment. Hence i manipulate the script as below and i am... (2 Replies)
Discussion started by: sv0081493
2 Replies

6. Shell Programming and Scripting

Problem in Sending mail as an attachment

Hi, I need to send a email as a txt file and i used the commands, (echo `echo $EMAIL_MSG` ; uuencode "file.txt" "file.txt" ) | mailx -s "$EMAIL_SUBJECT" "$EMAIL_ID" I received email with a attachment with all data but i get all of them in one row. For example: If file.txt contains value... (1 Reply)
Discussion started by: skcvasanth
1 Replies

7. UNIX for Dummies Questions & Answers

Issue on sending a mail with attachment using unix script ?

Issue on sending a mail with attachment using unix script ? Below is my code and is working fine and there is a issue in the attachment, the attachment file printing as a text-encripted message in the mail draft box instead of putting as a attachment (cat $msg; uuencode $attach1 in1.txt ;... (2 Replies)
Discussion started by: gksenthilkumar
2 Replies

8. Shell Programming and Scripting

Sending HTML attachment through mail

Hi I am new to unix and scripting.I am trying to send a html file as an attachment. SUBJECT="Type of Exceptions in Application" TO=Sushovan.Samals@gmail.com SPOOLFILE=/data/reg/tlogs/Monitor.html #echo "Send the E-mail message..." uuencode $SPOOLFILE $SPOOLFILE | mailx -s "$SUBJECT" $TO... (2 Replies)
Discussion started by: sushovan
2 Replies

9. UNIX for Dummies Questions & Answers

Sending attachment thru a mail

Is there any way we can send file attachemnts through mails from a unix server. Does the 'mail' command have such an option ?? (1 Reply)
Discussion started by: Rohini Vijay
1 Replies

10. UNIX for Dummies Questions & Answers

Error when sending mail attachment

I have been sending an email attachment from my unix box, but keep getting an error? All though the recipient still receives the email and attachment. Will this error cause problems in the future and how to I cure it? $ uuencode PReSvPRINTER.txt file | mailx -s "File" me@world.com uuencode:... (1 Reply)
Discussion started by: dbrundrett
1 Replies
Login or Register to Ask a Question