gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Have I now broken the nagging?
Date Fri, 05 Mar 2004 16:37:32 GMT
On Fri, 5 Mar 2004, Adam R. B. Jack <ajack@apache.org> wrote:

> With the two envelopes (real and display) the presentation style
> addresses x <y> were messing things up. I had to strip everything
> outside the < > for the real SMTP envelope.

Thats perfectly OK for the envelope which shouldn't have any real name
info anyway.

See email.Utils parseaddr function for a builtin version of
sanitizeAddress.  I was thinking about using Header to just encode the
first part of the returned tuple and reconstruct the header again (for
the visible From header).

Something like 

[bodewig@bodewig de]$ python2
Python 2.2.2 (#1, Jan 30 2003, 21:26:22) 
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from email.Utils import parseaddr
>>> from email.Header import Header
>>> fromParts = parseaddr("Stefan Bodewig <bodewig@apache.org>")
>>> fromHeader = Header(fromParts[0], "iso-8859-1") 
>>> fromHeader.append(" <" + fromParts[1] + ">", "us-ascii")
>>> fromHeader.encode()
'=?iso-8859-1?q?Stefan_Bodewig?= <bodewig@apache.org>'

but it doesn't look right to me and I feel I must be missing
something.  The Header class should be smart enough to realize that
there is nothing to encode at all here.

> See that sanitizeAddress (bad name) that is what did that. I think
> you were passing Header strings into the lower level function, that
> tried to sanitize, and maybe dorked things up...

No, not if I've managed to read the code 8-)

The mail function uses the sanitized addresses for the envelope and
the encoded headers only end up in the data of the SMTP transaction,
this works just fine - except that the visible From header is used to
check subscription information.  If you look into the logs, you'll see
that the upstream SMTP server has accepted the mails, so the envelope
is fine.

> I wonder if we could just use those Header objects on the sanitized
> addresses, for the real envelope.

We probably should use a lot more from the email package, using
MIMEText to represent the body and encode it if necessary, Header for
the headers (there also is direct RFC compliant date support in Utils)
and the Message class to tie it all together.

I planned to look into it today but didn't find enough time.  I've
right now reverted the patches to make nagging work for the next few
runs in order to keep the progress we've been making with Avalon and
Slide going on.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Mime
View raw message