Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#309176 - 16/04/2008 09:04 fetchmail frustrations.....
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3995
Loc: Manchester UK
We've got this great video transcoder that accepts files from all sorts of sources (including email). The problem I have is that in order to do this it implements an SMTP server which you're supposed to then send email to. I don't want to have to open up ports to make this thing visible from the outside, plus I can't easily use an email belonging to an existing domain that's already got MX records pointing to our main SMTP servers.

Simple, I thought, use fetchmail to grab the emails from the internal POP3 server and deliver to the smtp server on the transcoder. I can also masquerade the email address to make it easier to remember (the transcoder requires a specific syntax which has to include a valid username for the system).

Now here's the problem, the public-facing email address is (for example) [email protected], the transcoder expects it to be [email protected]. From looking at the session between fetchmail and the transcoder it writes the RCPT TO: to the correct email ([email protected]) but the contents of the email contain a To: header for [email protected]. Looking at the transcoder's logs it's this header that the transcoder uses to determine who the mail is for.

Bearing in mind this thing needs to run as a daemon, is there a simple (or complicated) way to rewrite this To: header to point to the right address?
_________________________
Cheers,

Andy M

Top
#309179 - 16/04/2008 10:28 Re: fetchmail frustrations..... [Re: andym]
pca
old hand

Registered: 20/07/1999
Posts: 1102
Loc: UK
I think you can probably use procmail to achieve what you require. I'm no expert with it, but I seem to recall from the documentation that it has the facility to do search and replace on email, as well as redirecting it.

pca
_________________________
Experience is what you get just after it would have helped...

Top
#309182 - 16/04/2008 12:09 Re: fetchmail frustrations..... [Re: andym]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14484
Loc: Canada
Mmm.. it sounds as if fetchmail already knows to do this by default, unless the -n | --norewrite flag is given. Not working ?

-n | --norewrite
(Keyword: no rewrite) Normally, fetchmail edits RFC-822 address headers (To, From, Cc, Bcc, and Reply-To) in fetched mail so that any mail IDs local to the server are expanded to full addresses (@ and the mailserver hostname are appended). This enables replies on the client to get addressed correctly (otherwise your mailer might think they should be addressed to local users on the client machine!). This option disables the rewrite. (This option is provided to pacify people who are paranoid about having an MTA edit mail headers and want to know they can prevent it, but it is generally not a good idea to actually turn off rewrite.) When using ETRN or ODMR, the rewrite option is ineffective.

Top
#309183 - 16/04/2008 12:35 Re: fetchmail frustrations..... [Re: mlord]
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3995
Loc: Manchester UK
Here's my .fetchmailrc

Code:
poll xxx.xxx.xxx.xxx
with proto POP3
user 'nicename' there is [email protected] here
password 'password'
smtphost yyy.yyy.yyy.yyy


The only command line options i'm running is -v.
_________________________
Cheers,

Andy M

Top
#309184 - 16/04/2008 13:04 Re: fetchmail frustrations..... [Re: mlord]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Mark, the -n option just adds a missing "@example.com" to email addresses.

As per usual, fetchmail has every option in the world except the one you want.
_________________________
Bitt Faulk

Top
#309192 - 16/04/2008 17:17 Re: fetchmail frustrations..... [Re: wfaulk]
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3995
Loc: Manchester UK
Hmmm, looks like combination of crontabs, bash scripting, procmail, fetchmail and sendmail are going to be involved, dammit.
_________________________
Cheers,

Andy M

Top
#309193 - 16/04/2008 17:24 Re: fetchmail frustrations..... [Re: andym]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
A perl, python, ruby, tcl, forth, or whatever-your-favorite-pet-language-is script would probably be easier.
_________________________
Bitt Faulk

Top
#309195 - 16/04/2008 19:56 Re: fetchmail frustrations..... [Re: andym]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14484
Loc: Canada
Well, sendmail is designed for this sort of thing. There is undoubtedly a trivial one-liner for the config file to make this happen for you.

The trick is understanding the config file.. smile

Top
#309210 - 17/04/2008 05:27 Re: fetchmail frustrations..... [Re: mlord]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5914
Loc: Wivenhoe, Essex, UK
The last day I ever need to look at a sendmail config file will be a good one frown

Mind you, the config files of other SMTP server don't seem to be that much more understandable. It is about time we threw out the mess that is SMTP and had a new truely simple mail transport.
_________________________
Remind me to change my signature to something more interesting someday

Top
#309221 - 17/04/2008 11:48 Re: fetchmail frustrations..... [Re: andy]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
Postfix configuration files aren't too bad. Anything is better than the line noise configuration files of Sendmail however...

Top
#309248 - 18/04/2008 07:54 Re: fetchmail frustrations..... [Re: tman]
LittleBlueThing
addict

Registered: 11/01/2002
Posts: 612
Loc: Reading, UK
Well, rather than a full blown sendmail/exim etc install would this do?

http://search.cpan.org/~macgyver/SMTP-Server-1.1/Server/Relay.pm

and then s/To:.../To:[email protected]/
(which looks like it might be trrvial)

Set it to run on a new port (2525?) and use 'smtphost yyy.yyy.yyy.yyy/2525' in fetchmail

_________________________
LittleBlueThing Running twin 30's

Top
#309249 - 18/04/2008 14:29 Re: fetchmail frustrations..... [Re: LittleBlueThing]
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3995
Loc: Manchester UK
Hmm, cunning.... Just downloading the relevant bits from CPAN now. Forgot to mention that I'm having to run all this under Cygwin.
_________________________
Cheers,

Andy M

Top