Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

mail command

SOLVED
Go to solution
viseshu
Frequent Advisor

mail command

Hi All,
I need to attach a document in a mail and send it from HP-UX box to my personal mail id. when i gave the following command,trying to attach abc.txt,
uuencode abc.txt abc.txt |mail id@domain.com,
i could receive the mail but there is no new line in the received file..all the lines gets displayed in a single line with a box as delimeter. Can this be over come?
16 REPLIES
Anshumali
Esteemed Contributor
Solution

Re: mail command

You forgot
ux2dos abc.txt
Prepend this before your command and pipe the output to your command mentioned above.

ux2dos abc.txt|uuencode abc.txt abc.txt |mail id@domain.com

Should solve it for you.

:)
Anshu
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
whiteknight
Honored Contributor

Re: mail command



Hi viseshu,

Here is the steps

http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en&docId=emr_na-c01028039-2



WK
Problem never ends, you must know how to fix it
viseshu
Frequent Advisor

Re: mail command

Hi Anshu, thnks for ur reply. But unfortunately, giving ux2dos command is resulting in the same error. Should the reciepient use uudecode to decode it?? If so is there any alternative as im sending mail to personal mail id and they can decode that.
AwadheshPandey
Honored Contributor

Re: mail command

http://www.uaex.edu/bknox/email_with_attachment.htm
It's kind of fun to do the impossible
viseshu
Frequent Advisor

Re: mail command

Hello WK,
I could not login to the url u have given, please help me out.

Thanks
Dennis Handly
Acclaimed Contributor

Re: mail command

I also found that wordpad will read UNIX formatted .txt files.

>Anshu: ux2dos abc.txt|uuencode abc.txt abc.txt |mail id@domain.com

When you want uuencode to take it from stdin, you only want one filename:
ux2dos abc.txt | uuencode abc.txt | mail id@domain.com
Anshumali
Esteemed Contributor

Re: mail command

Here are the commands i used:

uuencode /tmp/abc.txt abc.txt | mailx -m -s "hi" id@domain.com

Your issue replicated.File as attachment with square as attachement.

but with

ux2dos abc.txt | uuencode abc.txt| mailx -m -s "hi" id@domain.com

No issue. File received in redable format without squares.

could you use the above and let me know the result. I used mailx if you noticed!!

use mailx and test. Post Results.....

PS: Please assign points if this solves. I hope i would. :)

Anshu

Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
Anshumali
Esteemed Contributor

Re: mail command

You are right Dennis!
In my above example i did that..... ;)

Thanks for pointing out.
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
Anshumali
Esteemed Contributor

Re: mail command

viseshu,

Dennins is correct in saying that wordpad reads the same file sucessfully while notepad isnt able to and shows squares.

You may open it with wordpad w/o issues. But most of the time default file assignment of txt files are with notepad. :)

Cheers!!
Anshu
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
whiteknight
Honored Contributor

Re: mail command


Viseshu,

Same document as Ashu given. Please link your ITRC system handle, so that you can access to our knowledge base.

WL
Problem never ends, you must know how to fix it
Dennis Handly
Acclaimed Contributor

Re: mail command

>giving ux2dos command is resulting in the same error.

My previous reply had the solution.
Basically, pipe/stdin is ignored on most commands if you specify a file on the command line.
whiteknight
Honored Contributor

Re: mail command


Viseshu,

Same document as Ashu given. Please link your ITRC system handle, so that you can access to our knowledge base.

WK
Problem never ends, you must know how to fix it
viseshu
Frequent Advisor

Re: mail command

Thank you Anshu/Dennis for the help.
Using ux2dos abc.txt | uuencode abc.txt|mail id@domain.com, work is done but i can see one square in last line of the txt document. Can this square be suppressed. :(
Dennis Handly
Acclaimed Contributor

Re: mail command

>I can see one square in last line of the txt document. Can this square be suppressed?

ux2dos(1) adds a control-Z to the end for DOS. But you are using windows and it no longer likes that.

I suppose you can use tr(1) to remove it:
ux2dos abc.txt | tr -d '\032' | uuencode abc.txt | mail id@domain.com
Anshumali
Esteemed Contributor

Re: mail command

translatin/ deleting the character should be ok . It works fine.
Still, i prefer to use wordpad. ;)
Thanks Dennins for wordpad enlightment!!

Anshu
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
viseshu
Frequent Advisor

Re: mail command

Thanks for the help Dennis/Anshu
Its done!!!!