2009/2/5 Clodoaldo Pinto Neto <clodoaldo.pinto.n...@gmail.com>:
> 2009/2/5 Victor Duchovni <victor.ducho...@morganstanley.com>:
>> On Thu, Feb 05, 2009 at 07:54:39PM -0200, Clodoaldo Pinto Neto wrote:
>>
>>> The To: header I'm sending appears like this in the log:
>>>
>>> Feb  5 21:27:03 centos5151155 postfix/cleanup[4595]: B1AD3FF9A7:
>>> warning: header To:
>>> =?utf-8?q?D=C3=A9ste_Sobrenome_Grande_P=C3=B4cas_da_Silva_=3Cclodoaldo=5F?=?
>>> =?utf-8?q?pinto=40yahoo=2Ecom=2Ebr=3E?= from
>>> localhost.localdomain[127.0.0.1]; from=<ad...@carroarodo.com>
>>> to=<clodoaldo_pi...@yahoo.com.br> proto=ESMTP
>>> helo=<centos5151155.aspadmin.net>
>>>
>>> But it arrives like this in both Yahoo and Gmail:
>>>
>>> To: 
>>> =?utf-8?q?d=c3=a9ste_sobrenome_grande_p=c3=b4cas_da_silva_=3cclodoaldo=5...@centos5151155.aspadmin.net,
>>>       =?utf-8?q?pinto=40yahoo=2ecom=2ebr=3...@centos5151155.aspadmin.net
>>>
>>
>> What broken piece of garbage is abusing RFC 2047 to encode recipient
>> addresses rather than display names? In what form does this message
>> enter your system? (capture full packets with tcpdump and decode the
>> SMTP payload for both the original message coming in and the resulting
>> message going out).
>>
>> --
>>        Viktor.
>>
>> Disclaimer: off-list followups get on-list replies or get ignored.
>> Please do not ignore the "Reply-To" header.
>>
>> To unsubscribe from the postfix-users list, visit
>> http://www.postfix.org/lists.html or click the link below:
>> <mailto:majord...@postfix.org?body=unsubscribe%20postfix-users>
>>
>> If my response solves your problem, the best way to thank me is to not
>> send an "it worked, thanks" follow-up. If you must respond, please put
>> "It worked, thanks" in the "Subject" so I can delete these quickly.
>>
>
> It is probably my mistake. This is the python code that produces it:
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> from email.Message import Message
> from email.Header import Header
> from email.Utils import formataddr
>
> m = Message()
> m['To'] = Header(formataddr((to, recipient)), 'utf-8')
> helo = 'centos5151155.aspadmin.net'
> smtpserver = smtplib.SMTP(dest_server,port=25)
> smtpserver.ehlo(helo)
> smtpserver.helo(helo)
> smtpserver.sendmail(sender, recipient, m.as_string())
>
> I will try to fix it.

To the future readers, this seems to fix it:

m['To'] = '%s <%s>' % (Header(to, 'utf-8'), recipient)


>
> Clodoaldo
>

Reply via email to