Operating System - HP-UX
1752286 Members
4558 Online
108786 Solutions
New Discussion юеВ

Re: mailx - send an email with a file attachment

 
Claus Schlotz
Occasional Contributor

mailx - send an email with a file attachment

Hello,
i am using HP-UX 11.23 PARISC on an rp4440.
To send emails to our application users we are using the sendmail service. We do not had any problems in the past with sendind emails like this: cat filename < mailx -s "subject" username

Now we want so send the filename not within the email but as an attachment. Can someone help me?
Sendmail-Version is Sendmail 8.11.1/8.11.1
Thank You
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: mailx - send an email with a file attachment

uuencode

From the man page:
uuencode foo foo | mailx -s 'new program' friend
"


Pete

Pete
Geoff Wild
Honored Contributor

Re: mailx - send an email with a file attachment

Also have a look at this thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=992688

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Gilbert Standen_1
Frequent Advisor

Re: mailx - send an email with a file attachment

I have an excellent script that was written by Dave Wotton. I will try to attach it to this post for your use. If it doesn't attach, you can also download it from the http://www.consultingcommandos.com website. This script, written by Dave Wotton, allows you to add attachments (not append to body of email) to your unix emails. For example, if you attach a comma delimited file using this script to your unix command line email, your end user recipients will be able to just click on the attachment and have the .csv comma-delimited file open up as an excel spreadsheet.
If I could take one thing with me into the next world it would be my valid login to HP ITRC Forums
Geoff Wild
Honored Contributor

Re: mailx - send an email with a file attachment

Gilbert - tried that script but get:

# mail_files
/usr/local/bin/mail_files[138]: shift: The specified number is not valid for this command.

Line 138 is the last line of this:

case "$1" in
-* ) : ;; # ignore it, let getopts handle flags
* ) TO=$1 ; shift ;;

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Dave La Mar
Honored Contributor

Re: mailx - send an email with a file attachment

Claus -
Attached is an inhouse doc we use with multiple uses of mailx including tha attachment.

Feel free to use whatever is usefull.

Regards,

-dl
"I'm not dumb. I just have a command of thoroughly useless information."
Steven E. Protter
Exalted Contributor

Re: mailx - send an email with a file attachment

Shalom,

Take a look at this script, it has code you can lift.

http://www.hpux.ws/mailfile2

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Michael Skora
Advisor

Re: mailx - send an email with a file attachment

This works for us where the PDF is the attachment and the E-mail body text is whatever ASCII you put in filename.txt:

# (cat /home/filename.txt; uuencode /home/attach.pdf attach.pdf) | mailx -s 'SubjectLine'
-r replyable.email@yourcompany.com
recepient.email@theircompany.com

Hope it works for you.
Mike