Operating System - HP-UX
1748081 Members
5306 Online
108758 Solutions
New Discussion

how to use "mail" command send mail in internet! tks!

 
Eric_yuan
New Member

how to use "mail" command send mail in internet! tks!

how to use "mail" command send mail in internet! tks!
pls detail.
1 REPLY 1
OFC_EDM
Respected Contributor

Re: how to use "mail" command send mail in internet! tks!

This all assumes your sendmail is configured and that you're "allowed" to send mail externally to the internet

mailx is my preferred command

Echo body of message
--------------------
echo sometest | mailx -s "subject" emailaddr@somewhere.com

Redirect file with message
--------------------
mailx -s "subject" emailaddr@somewhere.com < file.txt

Attach a file
--------------------
uuencode /tmp/file.txt file.txt | mailx -s "subject" emailaddr@somewhere.com

- in this method you first give the path and name of the file
- then you give the name of the file (allows you to rename it if you like)

So I could also do
uuencode /tmp/file.txt file.doc | mailx -s "subject" emailaddr@somewhere.com

So the file shows up with a .doc extension and can be quickly opened with Word by the user (dbl click) when it's received in Outlook as an example.
The Devil is in the detail.