Link to home
Start Free TrialLog in
Avatar of Computer Guy
Computer Guy

asked on

Sending an email with attachemtn via cron

Hi,

I want to send a txt file as an attachment via a cron command.

/usr/lib/sendmail email@domain.com < /path/to/file.txt

When I use the following command, the contents of the file are in the body and it is not an attachment.

How can I have the text file be an attachment?

Thanks!
Avatar of Computer Guy
Computer Guy

ASKER

This is a log file I want to email so I can view the errors if they occur. I want it sent once an hour which I have setup if that helps.
Avatar of omarfarid
try this

 /usr/bin/uuencode /path/to/file.txt  file.txt | /usr/lib/sendmail email@domain.com

This will send /path/to/file.txt as attachment "file.txt"
Please add above as crontab job. Do you need help in that?
ASKER CERTIFIED SOLUTION
Avatar of Seth Simmons
Seth Simmons
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial