The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
.
google unix.com



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sending email attachments venush UNIX for Dummies Questions & Answers 2 06-06-2008 01:42 AM
Sending multiple attachments deo2k8 Shell Programming and Scripting 1 01-08-2008 01:12 AM
sending attachments via unix Abhishek Ghose UNIX for Advanced & Expert Users 6 09-30-2005 04:49 PM
ksh : using mailx and attachments madmat Shell Programming and Scripting 2 08-01-2005 11:06 PM
sending files as attachments SmartJuniorUnix How do I send email? 9 04-13-2001 07:34 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-08-2007
vrk1219 vrk1219 is offline
Registered User
  
 

Join Date: Feb 2005
Location: Bangalore
Posts: 9
Exclamation Sending Attachments Through mailx

Dear All,
I'm using HP-UX and we have mailx as the mail client.
I want to send a mail from the OS once I get the count from a table on Oracle. I'm thinking of redirecting the count to a file in Unix and get the output. This output spoolfile has to be sent through mail for reference.
Please let me know how can I attach this spoolfile("Status`date '+%d%m%y%H%M'`.txt") to the mail.

Here is the code sample I'm using:

#!/bin/ksh

#. ./set_mail_details.ksh
ORACLE_HOME="/software/ora/oracle/product/8.1.7/"
export ORACLE_HOME
lp=0
count=`/software/ora/oracle/product/8.1.7/bin/sqlplus -s scott/tiger@ora <<EOP
set term off
set heading off feedback off verify off
SELECT count(1) FROM <Table> ;
exit;
/
EOP`

echo "$count" >> "Status`date '+%d%m%y%H%M'`.txt"
echo 'In script'
subject="Status Mail"
echo '\nsubject'
echo "$subject" | sed 's/~/ /g' | read sub
body_of_email=`cat ./Mail.txt`
echo '\nBody\n\n'
echo '\nMail List'
to_list=<recipient@domain.com>
echo "$to_list"
echo "$body_of_email" | sed 's/~/ /g' | read body
(echo "$body";echo "The Count is:\t";echo "$count";echo "\n"; cat MailFooter.txt )| mailx -s "$sub" -r <sender@domain.com> "$to_list"

if [ $? -eq 0 ]
then
echo "Mail is Sent"
else
echo "Mail is not sent(In script)"
fi
  #2 (permalink)  
Old 08-08-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
Sending a file as attachment through mailx command

Code:
uuencode file_name file_name | mailx -s "Subject of mail" "receive@domain.com"
  #3 (permalink)  
Old 08-08-2007
vrk1219 vrk1219 is offline
Registered User
  
 

Join Date: Feb 2005
Location: Bangalore
Posts: 9
hi,
I have even used similar version of the command, but that is also not working....

Please help me.

Regards
RK Veluvali
  #4 (permalink)  
Old 08-08-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
I have worked with uuencode in HP-UX. Give a try by executing the uuencode by issuing the full path.

If not then try to check out from similar threads like Mail with attachment
  #5 (permalink)  
Old 08-27-2007
subh5 subh5 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 1
Problem attaching more than 1 file in single email, using uuencode and mailx command

Hi,
I'm just debugging some UNIX code which is to be used to send multiple attachments in a single mail.I'm using:

(uuencode $FILE $FILENAME; uuencode $FILE1 $FILENAME1) | mailx -s "$SUBJECT" somebody@some.com

The problem is that, I'm receiving the e-mail with the first file attachment all OK, but the 2nd file as something like :
begin 644 myfile.zip
M4$L#!`H``````*I.)1\]0KO)J5(6`*E2%@`,````1%)5241$,# 0N6DE04$L#
M!`H``````)9C#Q_E,1QY)3D6`"4Y%@`,````1%)5241$14TN03` S8.HL`!X&
M`0`4``*1D6,5'Y%C%1\``````````````````$1254E$1$5-+D$P,P` `<`V[

So, probably, it's printing the encoded file in the mail body for the second attachment.
Can you please help me out with this problem.
A lot of thanks.

Subh
  #6 (permalink)  
Old 12-23-2008
AJ69 AJ69 is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 1
Sending attachments with mailx on HP-UX

I had a request at work to have a report that runs via cron to mail the output as an attachment, which originally brough me to The UNIX and Linux Forums - Learn UNIX and Linux from Experts (via Google.) After finding that I had already tried all of the suggestions I found here I kept looking and a helpful coworker shared with me the one command line option that made it work.

uuencode filename.txt filename.txt | mailx -m -r fromaddress@domain.com -s "Subject" toaddress@domain.com

The -m option (see man mailx) causes mailx to not include mime headers. Adding this single option allowed me to send a file as an attachment instead of having it appear in the body of the message.

You can thank Wayne Shen for this hint I'm sharing.

While researching the question about multiple attachments I found the following. If you uuencode each attachment you can have a message body as well as multiple attachments, i. e:

uuencode file1.txt file1.txt > file1.uuencoded.txt
uuencode file2.txt file2.txt > file2.uuencoded.txt
cat MessageBody.txt file1.uuencoded.txt file2.uuencoded.txt | mailx -m -r fromaddress@domain.com -s "Subject" toaddress@domain.com
  #7 (permalink)  
Old 01-15-2009
palanisvr palanisvr is offline
Registered User
  
 

Join Date: Mar 2007
Location: India
Posts: 16
Use send mail.......

This should work....

SUBJ="Send mail from Unix with file attachments"
TO=someone@domain_name
CC=someoneelse_1@domain_name,someoneelse_2@domain_name
(
cat << !
To : ${TO}
Subject : ${SUBJ}
Cc : ${CC}
!

cat << !
HOPE THIS WORKS
This sample E-mail message demonstrates how one can attach
files when sending messages with the Unix sendmail utility.
!

uuencode ${file_1} ${file_1}
uuencode ${file_2} ${file_2}
uuencode ${file_3} ${file_3}
!

) | sendmail -v ${TO} ${CC}

if still it is not working try this mailx :

(uuencode a.txt a.txt ; echo "this is body text " )| mailx -m -s a@yahoo.com
NOte : while sending attachement s u must use -m option
Closed Thread

Bookmarks

Tags
mailx, mailx attachment

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0