cancel
Showing results for 
Search instead for 
Did you mean: 

Piping emails into a .pl script

N/A

Piping emails into a .pl script

Does anyone know whether Force9 would allow me to edit the /etc/aliases file so I can set up sendmail
to automatically sent emails to a CGI script? I noticed when Telnetting onto crofters that the /ect path is located in root (I attempted to vi the aliases file, but it told me that the file was opened read-only, so I logged off as I didn't want to get into trouble!).

If not, would they be able to do it for me if I gave them the lines to insert?

I need to pipe all messages for a specific recipient to the script so it can sent the emails directly into my Helpdesk application as requests.

Regards,

Darren brown

E-maker Web Ventures Ltd
d.brown@e-maker.co.uk
http://www.e-maker.co.uk
1 REPLY
N/A

RE: Piping emails into a .pl script

> Does anyone know whether Force9 would allow me to edit the /etc/aliases file so I can set up sendmail
> to automatically sent emails to a CGI script? I noticed when Telnetting onto crofters that the /ect path is located in root (I attempted to vi the aliases file, but it told me that the file was opened read-only, so I logged off as I didn't want to get into trouble!).
>
> If not, would they be able to do it for me if I gave them the lines to insert?
>
> I need to pipe all messages for a specific recipient to the script so it can sent the emails directly into my Helpdesk application as requests.
>
> Regards,
>
> Darren brown
>
> E-maker Web Ventures Ltd
> d.brown@e-maker.co.uk
> http://www.e-maker.co.uk


Hi Darren,

Unfortunately I don't believe that we would be able to provide such a configuration for you (it's a little more complex then it might seem - don't forget that your mail isn't handled by Crofters at all so the config files there are irrelevant) but I will make further enquiries when I return to work (I'm currently on holiday :-) However, in the short term I can tell you about a workaround I've used in a similar situation in the past: fetchmail.

Fetchmail is a great tool that retrieves email from a mailbox (using POP3 or IMAP in our case but it supports a wide range of protocols) on any named server, and then feeds it to your choice of a separate smtp server (so it's an efficient email redirector - or a local MDA (mail delivery agent).

The clever part comes when you specify the local MDA (it defaults to procmail, which is another *very* useful email utility... what you can't do to email with fetchmail and procmail isn't worth doing). You could specify your own script here, and all mail would be read from the account you specify and basically piped to your script. By default, if the MDA returns a nonzero status, the mail item in question will retained on the server and deleted otherwise, but there's a -k option that keeps it on the server regardless.

The website for fetchmail - http://tuxedo.org/~esr/fetchmail/ - has a lot of information but the option you'll be needing for this sort of setup is "--mda yourscript.pl"

for example:

fetchmail -k --mda yourscript.pl --username yourusername mail.force9.net

(this will ask you for a password interactively - setup to avoid this is possible with config files but this would have security implications on Crofters, for which no immediate solution springs to mind)

Fetchmail was written by Eric S. Raymond, a Reasonably Important Person in the history of the Internet and the Open Source movement (he wrote "the Cathedral and the Bazaar" - http://www.tuxedo.org/~esr/writings/cathedral-bazaar/ which is well worth reading).

(Don't forget of course that as a general rule we're not able to provide support on topics like this - I've just picked up on your question as it's one that I've asked in the past, and as I'm a big fan of fetchmail)

Best wishes,

Matt.

--
| Matt Saunders......................Unmetered & ADSL solutions
| Technical Support............................for Home & Business
| PlusNet Technologies Ltd...............@ http://www.plus.net
+ ----- My Referrals - It pays to recommend PlusNet --------+