开发者

AppEngine vs. sendmail space problem

I am using sendmail to be able to send mails from AppEngine while it is running locally (i.e. dev_appserver.py). Here is my code:

mail.send_mail(
    sender="SenderName <sender@domain.name",
    to= "ReceiverName <receiver@domain.name>",
    subject=subject,
    body=text,
    html=html)

When I execute this code, with proper emails and other parameters, I get this error:

/bin/sh: Syntax error: end of file unexpected
ERROR    2010-12-23 19:31:16,459 mail_stub.py:177] Error sending mail using sendmail: [Errno 32] Broken pipe

After some investigation it turned out that the error (i.e. broken pipe) is caused because of the syntax of the 'sender' and 'to' emails. If I only keep the email (rather than the name also), the problem is solved. This tells me that AppEngine is dumping the parameters to sendmail without suitable quotes. So something like:

sendmail .... SenderName <sender@domain.name> ReceiverName <receiver@domain.com>

Obviously, this will cause parameter conflicts because the shell can't know that is part of the sender email, and this is causing the problem.

Any idea how to solve this problem? I want to keep the names in the emails.

By the way, this works fine when I uploa开发者_JS百科d my code to AppEngine, but I want to solve it locally too to avoid having to change the code every time I am testing.


There's an issue for this in the App Engine issue tracker, which includes a patch to add quotes around the addresses, at http://code.google.com/p/googleappengine/issues/detail?id=3106

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜