cancel
Showing results for 
Search instead for 
Did you mean: 

Email Text from Log File

Chad Brindley
Regular Advisor

Email Text from Log File

Hi,

HPUX 11.23

I would like to add a line to a script to mail the text from a log file as the body of an email.

Can anyone tell me the syntax of the mail command, I have done man mail and cannot work out the correct command.

The command I have tried was;

cat filename | mailx -s "test" email.address@nowwhere.com

I got an email with the subject "test" but had an attachment with my log file information in and also this error message in the body of the email;

"This message uses a character set that is not supported by the Internet Service. To view the original message content, open the attached message. If the text doesn't display correctly, save the attachment to disk, and then open it using a viewer that can display the original character set."

I changed my outlook to plain text but have not received the last test email I sent. I dont know why, emailing from unix is quite new to me.

Chad
4 REPLIES
Robert-Jan Goossens_1
Honored Contributor

Re: Email Text from Log File

Hi Chad,

Try this one

mailx -s "test" email.address@nowwhere.com < filename

Regards,
Robert-Jan
harry d brown jr
Honored Contributor

Re: Email Text from Log File

I like to receive logs as attachments:

uuencode filename filename.txt |mailx -m -s "test" email.address@nowwhere.com

The "-m" is important for mime encoded emails

live free or die
harry d brown jr
Live Free or Die
Peter Godron
Honored Contributor
Chad Brindley
Regular Advisor

Re: Email Text from Log File

Sorted, thanks to the response from Peter Godron