Commit 5ac7ee53 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use email.utils.formataddr instead of '"%s" <%s>' to support double-quotes and...

use email.utils.formataddr instead of '"%s" <%s>' to support double-quotes and backslashes correctly.
parent 6f3992d5
......@@ -50,8 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
<value> <string>from email.utils import formataddr\n
portal = context.getPortalObject()\n
\n
if body is None:\n
......@@ -64,11 +63,7 @@ if subject is None:\n
# From\n
if from_url is None:\n
sender = context.getSourceValue()\n
if sender.getTitle():\n
from_url = \'"%s" <%s>\' % (sender.getTitle(),\n
sender.getDefaultEmailText())\n
else:\n
from_url = sender.getDefaultEmailText()\n
from_url = formataddr((sender.getTitle(), sender.getDefaultEmailText()))\n
\n
# Return-Path\n
if reply_url is None:\n
......@@ -83,10 +78,7 @@ if to_url is None:\n
for recipient in context.getDestinationValueList():\n
email = recipient.getDefaultEmailText()\n
if email:\n
if recipient.getTitle():\n
to_url_list.append(\'"%s" <%s>\' % (recipient.getTitle(), email))\n
else:\n
to_url_list.append(email)\n
to_url_list.append(formataddr((recipient.getTitle(), email)))\n
else:\n
raise ValueError, \'Recipient %s has no defined email\' % recipient\n
elif same_type(to_url, \'\'):\n
......@@ -138,9 +130,7 @@ if context.getTypeInfo() is not None:\n
\n
if download:\n
return mail_message\n
]]></string> </value>
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......
991
\ No newline at end of file
992
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment