Automatic email with attachment?
Hal Burgiss
hal at burgiss.net
Sat May 29 12:14:13 UTC 2010
On Fri, May 28, 2010 at 7:46 PM, H.S. <hs.samix at gmail.com> wrote:
> Patton Echols wrote:
>> I have a need to email files to various folks on a regular basis. I
>> would like to automate the process. My idea is that a file would get
>> dropped into a particular folder. Normally the folder would be empty.
>> But when a file is dropped there, it is automatically attached to an
>> email and sent to an email address.
>>
>> Does anyone know of a prebuilt utility that will do this? If I need to
>> script it, does anyone have a script that they use for this purpose?
>>
>> I have a vague memory of something like this on the list, but I have
>> been unable to construct a search that gets me anything.
>>
>> (The worse bit is I think I participated in the thread, and I STILL
>> can't find it. Obviously I'm an idiot!)
>>
>> Thanks for aiding the hopeless
> Here is one option:
> http://www.cyberciti.biz/tips/sending-mail-with-attachment.html
>
> It should be easy to create a cron job that runs every periodically (few
> minutes, half hour, whatever) to call a bash script that checks if a
> particular directory has any file in it, if yes, then send that file as
> an attachment and then to remove them.
You might could by without needing a script and do it all from within cron:
*/10 * * * * cd ~/attach ; [ -f attach.txt ] && echo "See attached"
|mutt -s "Here ya go" -a attach.txt joe at example.com && rm attach.txt
Note: not fully tested.
--
Hal
More information about the ubuntu-users
mailing list