Email-Auto-Responder+Web Gateway
James Wilkinson
james at westexe.demon.co.uk
Wed Jan 12 23:16:54 UTC 2005
Ow Mun Heng wrote:
> As most of you know (or should, as I've rant'ed about it often enough)
> I don't have any I-net access at work, and sometimes, when ppl point me
> to links, I can't access it. I've been living with a Email-to-Web
> Gateway since someone told me about it (FYI: it's a service where you
> send an email with the URL to the address and it will re-send you the
> page)
Paul Howarth wrote:
> This should be fairly easy to build yourself, using procmail as a base
> to identify URL requests from authorised addresses (i.e. your work
> address) and call up formail to create the basis for a reply email, then
> curl to actually download the requested URL. Should make for an
> interesting evening's project :-)
Ow Mun Heng replied:
> You're having too much confident in me! It would take me more than an
> evening. (A Couple of evenings Even!)
Ah. A challenge.
A few minutes experimenting suggests that something like this in
.procmailrc
:0
* ^Subject: webfetch
* ^From:.*someone at example.com
| /home/user/bin/webfetch
with a /home/user/bin/webfetch file like
#!/bin/bash
for i in `grep "^get: " | cut -c5-`
do
(
cat << END_HEADERS
To: someone at example.com
Subject: $i
MIME-Version: 1.0
Content-Type: text/html
Content-Transfer-Encoding: 8bit
END_HEADERS
/usr/bin/wget $i -O - 2>/dev/null
) | /usr/sbin/sendmail -t
done
will do the job: send e-mails from someone at example.com with the subject
webfetch and the line
get: redhat.com
and you'll get the web page by return of e-mail.
You won't get any images: this might not be a problem. You might want to
play around with wget's options.
> PS : I'm using Cyrus + Postfix and thus, currently I don't have a use
> for procmail. Will Sieve work? But seriously, running Cyrus, does seem
> to make things harder.
Don't know: can it pass e-mails to arbitrary scripts?
James.
--
E-mail address: james | They say that every cloud has a silver lining, which
@westexe.demon.co.uk | must be a bit alarming for airline pilots...
| -- "I'm Sorry, I Haven't A Clue", BBC Radio 4
More information about the fedora-list
mailing list