aioshin Posted February 15, 2006 Report Share Posted February 15, 2006 (edited) I want to put it as cron job, run the command on a particular time, attaching a certain file... . I tried mutt but I dont know how to do it on a single command then run by cron.. . any tips? :unsure: [moved from Software by spinynorman] Edited February 16, 2006 by aioshin Quote Link to comment Share on other sites More sharing options...
devries Posted February 15, 2006 Report Share Posted February 15, 2006 Make a script and have the script run through cron. :) Quote Link to comment Share on other sites More sharing options...
paul Posted February 15, 2006 Report Share Posted February 15, 2006 mailx -s "my subject" -F /path/to/file.name me@email.address if you want to add some plain text .. try this sh /command/that/outputs/text | /bin/mailx -s "Subject" -F file.name me@email.address or echo "Here is some plain text" | /bin/mailx -s "Subject" -F file.name me@email.address Quote Link to comment Share on other sites More sharing options...
aioshin Posted February 16, 2006 Author Report Share Posted February 16, 2006 (edited) mailx -s "my subject" -F /path/to/file.name me@email.address if you want to add some plain text .. try this sh /command/that/outputs/text | /bin/mailx -s "Subject" -F file.name me@email.address or echo "Here is some plain text" | /bin/mailx -s "Subject" -F file.name me@email.address thanks paul... but when I follow the above commands, this is what I get... [root@fileserver ~]# mailx -s "see attached file" -F testfile.tar.gz aioshin@yahoo.com-bash: mailx: command not found . [root@fileserver ~]# slocate mailx /usr/share/man/man1p/mailx.1p.gz . [root@fileserver ~]# rpm -qal | grep mailx /usr/share/man/man1p/mailx.1p.gz that was invoke on my Centos box... . I also tried it on Mandriva [ken@nixbox ~]$ mailxbash: mailx: command not found [ken@nixbox ~]$ man mailx No manual entry for mailx [ken@nixbox ~]$ slocate mailx /usr/share/mailx /usr/share/mailx/mail.tildehelp /usr/share/mailx/mail.help [ken@nixbox ~]$ I tried to query info at mandriva MCC and the description of mailx is.. Name: mailxVersion: 8.1.1-24mdk Size: 89 KB . Summary: The /bin/mail program, which is used to send mail via shell scripts. . Description: The mailx package installs the /bin/mail program, which is used to send quick email messages (i.e., without opening up a full-featured mail user agent). Mail is often used in shell scripts. . You should install mailx because of its quick email sending ability, which is especially useful if you're planning on writing any shell scripts. . Files: /bin/mail /etc/mail.rc /usr/bin/Mail /usr/share/mailx /usr/share/mailx/mail.help /usr/share/mailx/mail.tildehelp /usr/share/man/man1/Mail.1.bz2 /usr/share/man/man1/mail.1.bz2 so I should have to use "/bin/mail instead of mailx, but mail does'nt have an attache option.. . any idea? . TIA Edited February 16, 2006 by aioshin Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted February 16, 2006 Report Share Posted February 16, 2006 (edited) If you install nail (not mailx) you will have a mailx command: Description :Nail is derived from Berkeley Mail and is intended to provide the functionality of the POSIX.2 mailx command with additional support for MIME messages, UTF-8, POP3/POP3s and SMTP. You can also manually set the From: address but it will be /usr/bin/mailx Edited February 16, 2006 by Steve Scrimpshire Quote Link to comment Share on other sites More sharing options...
paul Posted February 16, 2006 Report Share Posted February 16, 2006 install mailx or is nail installed? nail -s "Subject" -a attachment.tgz me@email.address Quote Link to comment Share on other sites More sharing options...
aioshin Posted February 16, 2006 Author Report Share Posted February 16, 2006 (edited) @steve . thanks for the info, I honestly, I did'nt know of that.. so I installed nail on Mandriva, but it does not have a mailx command, instead, it still uses nail... . @paul thanks, the command works echo "test" | nail -s test -a file-to-be-attached.tar.gz aioshin@yahoo.com . ok, I have'nt installed nail on my Centos since when I tried to do a yum list, it did'nt find anything on "nail" that will do the same job... but on other forum, I found email, a command line email client that can attach any file similar to nail... the website.. http://email.cleancode.org/?pid=download . just have to edit a little the /etc/email/email.conf, then [root@fileserver ~]# email -s "test" -b -f user-sending -q -a file-2-attach.tar.gz aioshin@yahoo.comSending "test" |******************************************************************************* ******| 100% of 54 KB E-Mail Sent or with a -q to supress the sending status . anyway, its now solved. . my reason of doing this is to backup some files and email it to a certain address. . Thank you! Edited February 16, 2006 by aioshin Quote Link to comment Share on other sites More sharing options...
paul Posted February 16, 2006 Report Share Posted February 16, 2006 I use mailx all the time for system reports in cron I do things like ps auxf | /bin/mailx -S "Running processes" system_admin@domain Quote Link to comment Share on other sites More sharing options...
aioshin Posted February 16, 2006 Author Report Share Posted February 16, 2006 me... I overlooked everything, while I can just also do the command echo "this is a test" | mutt -a file-2-attached.tar.gz email-me@domain.tld -s test since I have mutt already installed. . but anyway, its cool, I just learned 3 CLI based email clients that can attach file... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.