Command line sending of mail attachments ( DB backups)
Hello all
I'm am not remotely familiar with the linux operating sytem and just need a simple 'cut and paste solution' that will allow me to send .gz files as mail attachments, from the command line. Recently I moved my website to new hosting company, they are using cpanel and I have set up a couple of commands; the cpanel scheduler runs them for me as required. 1. creates an mysql dump and saves it to folder ( in root of my space ). Works fine. 2. delete the file created above, after 15 mins. Also works fine What I really want to do is email the .gz to myself before it is deleted, this is were I am stuck. This is possible ( I believe ) but it is beyond my understanding and ability to write the script/command that will make this happen. Please make any instructions really simple and clear as I am really new to this. Any help would be very much appreciated. There are several Pearl and PHP modules installed on the server and this information is provided below and may be helpful to you (but I certainly to not know anything about this type of stuff). More info about the server to come. |
modules on the server that I thought were relevant. There are a great many more.
Mail::Address Mail::Cap Mail::Field Mail::Field::AddrList Mail::Field:: Date Mail::Field::Generic Mail::Filter Mail::Header Mail::Internet Mail::Mailer Mail::Mailer::qmail Mail::Mailer::rfc822 Mail::Mailer::sendmail Mail::Mailer::smtp Mail::Mailer::testfile Mail::Send There are also a great number of mime modules installed, please ask me about anything specific that might be needed. |
You could use:
1. for one file: uuencode /path/to/mysql_dump.gz | mail -s "Mysql dump" user@somedomain.net 2. multiple files mutt -s "Mysql dump" -a /path/to/mysql_dump.gz /path/to/mysql_dump1.gz -- user@somedomain.net < /dev/null |
Thanks for the reply, I will try them and send a reply shortly.
GM |
Hi and thanks for your efforts
The first command did indeed send a message but no file can be attached. mutt does not appear to be running, as the second command has no effect and I have tried many configurations of this, from the web. Mmmmmmmmmmm anyone else have a solution? |
Try the following
Code:
mailx -a attachment.gz -s "Subject Here" user@domain.com </dev/null |
Thanks for your reply
No luck with this one, not the slightest hint of anything going on. GM |
Code:
uuenview -m email -f "my_email" -s "test subject" -a attachment.tar.gz << EOF |
All times are GMT -5. The time now is 03:56 PM. |