I am using mailx command in my script to attach a file and send an email. I need to attach a csv file and send email to a mail id -
I am using
uuencode output.csv output.csv | mailx -s "test mail" xyz@abc.com
This will send a mail with scrambled text in body.
am i missing something ? is there any other way to send a mail with attachment?
clx
2
Which OS do you have?
for HP-UX, try this
(echo 'this mail has attachment';uuencode output.csv output.csv) | mailx -m -s 'test mail' xyz@abc.com
If linux, try this,
echo 'this mail has attachment' | mailx -s 'test mail' -a output.csv xyz@abc.com
1 Like
Well, I use Ux-hp and that worked Anchal. Can u just explain how this works ? am confused how it is so different than my command line ?
clx
4
its not that much different. I just added a message to the body that's the reason.
the only difference from your command is the -m switch.
In term of your command, this would work,
uuencode output.csv output.csv | mailx -m -s "test mail" xyz@abc.com
-m option allows you not to include MIME headers.
in man pages terms:
-m Do not add MIME header lines Mime Version, Content
Type & Content Encoding to the header information
while sending mails.
hi, can you plz suggest how can i write a unix code which contains FROM, TO addressess and an attachment to send a mail from unix server