[Users] Rewrite URLs in message obfuscated by Outlook's safelinks stuff

Milan Obuch claws-mail-users at dino.sk
Thu Mar 21 08:57:14 UTC 2024


On Tue, 19 Mar 2024 09:12:32 -0400
George Avrunin <avrunin at comcast.net> wrote:

> On Tue, 19 Mar 2024 08:03:00 +0100
> Milan Obuch <claws-mail-users at dino.sk> wrote:
> 
> 
> > Hi,
> > 
> > I'd like to ask some more details about your intended setup. First,
> > where is your personal account served? Your mail is sent from
> > comcast.net domain, no clue for me here. Also, how should messages
> > get forwarded from GMail account to your personal account,
> > protocol-wise, and next, how should they being transferred to your
> > home machine? Dovecot is just IMAP/POP3 server, probably something
> > else is planned for message transfer here.
> > 
> > My preference for any mail message modification is running some
> > script as part of mail delivery process, if you have some
> > possibility to do so. I'd expect your home machine is under your
> > complete control, so you should be able to do it here. Lacking
> > details, no better suggestion could be done at the moment.  

[ snip some details on accounts ]

> But I'm not sure I could directly forward mail from GMail to a mail
> server at home through my home Comcast/Xfinity connection.  I haven't
> checked in quite a while, but Comcast used to block various ports and
> prevent the straightforward ways of running a full mail server on home
> accounts.  I can connect to my home network from outside through
> Wireguard (and in particular to the dovecot server so I can read mail
> that's stored on the home machine from outside), but I'm not sure I
> could forward mail to the home machine.  I haven't looked at using
> something like fetchmail, but a quick search suggests that fetchmail
> can use OAUTH2 with GMail by setting up a personal project, etc.,
> similar to the way claws-mail does it.  So that wouldn't work directly
> with my university account, but fetchmail could be used with both of
> my personal accounts.

So it looks like your are receiving mails to your university account,
personal gmail and personal comcast/xfinity account. Then you are
moving messages to your home mail storage server (IMAP).

From the description it looks like you could automate the process using
fetchmail, which is great - if you could forward mails from university
account to your personal gmail account, then you can use fetchmail to
download mails directly to your dovecot server. I did use fetchmail in
past, and it allows using some local delivery agent, where you can
script some mail message manipulation (procmail should work, I prefer
using maildrop as I use courier MTA for servers).

> > Python plugin allows you to get filename for a message, in theory
> > you could use that info to modify the file any way you like. There
> > is a problem, however, if you use IMAP for accessing mailbox,
> > filename is just for local cache of your message, and any
> > modification done here is probably not transferred to server. My
> > quick tests seem to confirm this.  
> 
> I wondered about that.    I would be satisfied with something that
> "only" fixed the URLs while I was using claws-mail (so that I could
> see the correct URL and clicking on the link would not send me through
> outlook.com) but did not modify the original message.  So perhaps
> modifying the local cache would be fine.  I don't understand enough
> about what claws is doing internally to know if this is feasible. 

If you use IMAP for mail access from multiple devices, that would not
be good for you - you could end up with different versions on different
devices. Message modification should be done on server (dovecot) side.

So my preferred solution would be using fetchmail with dovecot local
delivery agent and some filtering in there. First, detect message where
some safelink stuff is present, second, do the modification, and last,
delivery mail to local mailbox. This way, no need to do any processing
in Claws Mail, no troubles with multiple device access.

And maybe you can use H. Merijn Brand's perl script to do the message
mangling (or, better description, un-mangling) stuff. It is more than
ten years I used fetchmail for something similar.

Regards,
Milan


More information about the Users mailing list