1827870 Members
1177 Online
109969 Solutions
New Discussion

Sendmail help

 
SOLVED
Go to solution
Brian Ham
Advisor

Sendmail help

How do I attach files to a 'mail' command. (example: mail -s test email address)
I then want the body of the email to show the contents of a file (/var/adm/script/filename). I am trying all sort of things from the man page but can't figure this simple problem on my own.
3 REPLIES 3
Sergejs Svitnevs
Honored Contributor

Re: Sendmail help

Try the 'mpack' command which encodes the the named file in one or more MIME messages and directly mail it, or leave it as a string which can then be passed to a 'mail'.

Regards,
Sergejs
Solution

Re: Sendmail help

The command:
cat /var/adm/script/filename | mail -s subject email-address
will send a mail to email-address, the body of which is the content of the file /var/adm/script/filename.

Is that what you wanted?
Stephen
John de Villiers
Frequent Advisor

Re: Sendmail help

run sendmail you@email <`uuencode filename filename.tmp`
ATTACH