Re: Badly formed return address causes TMDA exception

"Todd A. Jacobs" <[email protected]> Fri, 8 May 2009 16:57:33 -0700
Newsgroups gmane.mail.spam.tmda.devel
Message-ID <[email protected]>
On Fri, May 08, 2009 at 07:26:28AM -0400, Lloyd Zusman wrote:

> more than one "@" character, and it causes the following TMDA
> exception (see below).

> What's the recommended method for fixing this?

I'm not really a python hacker, but as far as I can tell the code in
question is probably in:

    tmda/trunk/tmda/TMDA/Address.py

My guess is that the private _split() function isn't validating the
address properly. You could probably hack in a top-level exception
handler, but I think the right thing to do would be to validate the
address FIRST with a more exacting regex to ensure that only valid
characters are being used before attempting to split the address:

    [-a-zA-Z0-9_.?+]+@[-a-zA-Z0-9.]+

In perl, I'd just do something like:

    ($local, $domain) = /([-a-zA-Z0-9_.?+]+)@([-a-zA-Z0-9.]+)/

If no valid address is found, it's probably better to handle the
exception by bouncing the mail rather than trying to pass an invalid
result back to the caller.

-- 
"Oh, look: rocks!"
	-- Doctor Who, "Destiny of the Daleks"


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
tmda-workers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmda-workers