[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Sending mail with attachment via cron?




> Hi all
> I need to send a mail containing a file or contents of a text file via
> crontab. How is that done?
> Or is it possible to have PGP send a mail with the encrypted file?
>
>
> René Mølsted
>

René,

If you are familar with php or any other web-based programming language, you
can create a script that mails and encodes your data/message by adding a
line to your crontab similar to the example below. This method allows for a
much more flexible and robust system:

0 10 * * sun     /usr/bin/lynx -dump http://www.yourhost.com/yourscript.php
> /dev/null &

If you do not want this script to be accessible over the WWW, you may also
execute the script via console by creating a crontab entry similar to the
below example:

30 4 * * sat    /home/blah/yourscript.php

If you choose to use php, be sure to include the path to php in the header
of your script:

#!/usr/bin/php -q

<?

/* insert script here */

?>



Furthermore, here are some resources that may prove to be helpful:

http://ca.php.net/manual/en/ref.mail.php
http://www.webmasterworld.com/forum13/2194.htm
http://renoir.vill.edu/~ylee/mailfile.html

Good Luck!


Sincerely,

Paul Slavickas


Paul Slavickas
Senior Programmer & System Administrator
DONCOR.COM
60 King St. Unit 101
Welland, Ontario
Canada
L3B 5R2
Phone: 905-714-0599
Fax: 905-714-0479
Email: admin@xxxxxxxxxx