Re: [Nolug] automating email

From: Clint Billedeaux <clint_at_fastbadge.com>
Date: Thu, 14 Apr 2011 22:30:47 -0500
Message-ID: <BANLkTi==v1dCk_bvpVzPRPFaff5NLWmr4A@mail.gmail.com>

On Thu, Apr 14, 2011 at 10:04 PM, B. Estrade <estrabd@gmail.com> wrote:

> I would not use this script. There are more robust and complete
> solutions out there.
>

Thanks Brett. Actually, I've located some really simple...and I do mean
simple means of accomplishing the task.

>
> Brett
>
> On Thu, Apr 14, 2011 at 8:17 AM, Jerry Wilborn <jerrywilborn@gmail.com>
> wrote:
> > Beat to fit, paint to match... Then add to cron.
> > #!/usr/bin/php
> > if ($conn = imap_open("{mail.domain.com:110/pop3}INBOX", "
> user@domain.com",
> > "secret")) {
> > $mc = imap_check($conn);
> > if ($mc->Nmsgs) {
> > print "Handling {$mc->Nmsgs} message" . ($mc->Nmsgs == 1 ? '' : 's') .
> > ".\n";
> > $response = imap_fetch_overview($conn, "1:{$mc->Nmsgs}");
> > foreach ($response as $msg) {
> > if (preg_match("/(.*)\@domain\.com/", $msg->to, $matches) and $user =
> > $matches[1]) {
> > if (strtolower($user) == 'bob') {
> > // deal with attachments, see http://php.net/manual/en/book.imap.php for
> > example
> > // use file_put_contents to save body/attachments
> > } else {
> > // save to a catch-all location ?
> > }
> > }
> > }
> > }
> > }
> > Jerry Wilborn
> > jerrywilborn@gmail.com
> >
> >
> > On Thu, Apr 14, 2011 at 7:14 AM, Clint Billedeaux <clint@fastbadge.com>
> > wrote:
> >>
> >>
> >> On Thu, Apr 14, 2011 at 12:12 AM, Petri Laihonen <pietu@weblizards.net>
> >> wrote:
> >>>
> >>> Do you know any scripting languages such as PHP?
> >>>
> >>
> >> I've been lucky enough to whack a PHP file or two into what I want, but
> I
> >> would never admit in public that I even have a clue what PHP is.
> >>
> >>>
> >>> In the past, I made a PHP script to read mail, open the attachments and
> >>> then act upon the contents of said attachments. I was running the
> script
> >>> with cron, but nowdays I would just make a PHP script run as daemon
> which
> >>> can be stop|start|restart|etc just like any other daemon.
> >>>
> >>
> >> I like the idea of using PHP though. I'll look into it. Thanks.
> >>
> >>> IMHO, PHP is far easier than Procmail.
> >>>
> >>> P
> >>>
> >>> On Wed, Apr 13, 2011 at 11:19 PM, Clint Billedeaux <
> clint@fastbadge.com>
> >>> wrote:
> >>>>
> >>>> I'm trying to automate some very routine email handling done by the
> >>>> office staff.
> >>>> At present, one person is assigned to check an email inbox and save
> it's
> >>>> attachments to folders on the file server. I'm sure scripting this to
> >>>> happen throughout the day shouldn't be a huge ordeal, but I haven't
> the
> >>>> foggiest idea how to start. I looked at a few procmail scripts, but
> I'm
> >>>> coming up short on comprehending how to save the email attachments.
> >>>> Any ideas where I should look for help?
> >>>> Thanks,
> >>>> Clint
> >>
> >
> >
> ___________________
> Nolug mailing list
> nolug@nolug.org
>

___________________
Nolug mailing list
nolug@nolug.org
Received on 04/14/11

This archive was generated by hypermail 2.2.0 : 04/19/11 EDT