Operating System - HP-UX
1758664 Members
2172 Online
108874 Solutions
New Discussion юеВ

Re: force mailx to use input file as attachment

 
Paul Gold
Advisor

force mailx to use input file as attachment

our developers have scripts which produce a formatted output complete with control characters, they pipe this through mailx to distribute the report but are getting errors about null characters (which i expected with the control characters in the file)

Is tehre a way to make mailx use the input from pipe as an attachment by default, or should they use another mail program

TIA

Paul Gold
CAST Systems
4 REPLIES 4
Andreas Voss
Honored Contributor

Re: force mailx to use input file as attachment

Hi,

There are three ways to send and attachment.

# (1) Send in body of e-mail
mailx -s 'Subject Lines goes here' user@company.com < filename.txt

# (2) To send as an attachment
/usr/bin/uuencode filename.Z filename.Z | /usr/sbin/sendmail user@company.com

# (3) To send as an attachment with Subject, From and To

(
echo "From: "
echo "To: "
echo "Subject: "
echo "This is the body of the e-mail.^M
If you are having any problem with this file please give us a call.^M^M^M
^M
^M
"
/usr/bin/uuencode /local/filename filename
) | /usr/sbin/sendmail user@company.com

Regards
Lasse Knudsen
Esteemed Contributor

Re: force mailx to use input file as attachment

Could use uuencode before sending it to mailx
In a world without fences - who needs Gates ?
Andreas Voss
Honored Contributor

Re: force mailx to use input file as attachment

Hi,

there are several issues for this.
Do a SEARCH (button upper left corner)
Search criterea: 'mailx AND attachment'
Choose 'boolean' option
Hit the 'community forums' toggle button
and go.

Regards
Rita C Workman
Honored Contributor

Re: force mailx to use input file as attachment

Here's a url about another way to mail a file as an attachment. Our programmers here like this method I set up for them for mailing reports, instead of printing them. They liked it better than uuencode. But either way works....it's just a matter of choice.

http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x41950559ff7cd4118fef0090279cd0f9,00.html

Regards,