summaryrefslogtreecommitdiff
path: root/boto/ses
diff options
context:
space:
mode:
authorvikalp <vikalp@vikalp-laptop.(none)>2011-04-23 23:21:07 +0530
committervikalp <vikalp@vikalp-laptop.(none)>2011-04-23 23:21:07 +0530
commit44b611cb35de997e43354f28e988bc77628d62ad (patch)
treeedff33776f2a44adb3acd19b7394fa148bbed04a /boto/ses
parentad0f4aa82a8f30522b0ce3e40e40f145080bf955 (diff)
downloadboto-44b611cb35de997e43354f28e988bc77628d62ad.tar.gz
changed code to handle ses send_email method Exceptions better
Diffstat (limited to 'boto/ses')
-rw-r--r--boto/ses/connection.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/boto/ses/connection.py b/boto/ses/connection.py
index 67bf9321..e1259c18 100644
--- a/boto/ses/connection.py
+++ b/boto/ses/connection.py
@@ -151,6 +151,7 @@ class SESConnection(AWSAuthConnection):
:param html_body: The html body to send with this email.
"""
+ format = format.lower().strip()
if body is not None:
if format == "text":
if text_body is not None:
@@ -169,13 +170,16 @@ class SESConnection(AWSAuthConnection):
if return_path:
params['ReturnPath'] = return_path
- format = format.lower().strip()
if html_body is not None:
params['Message.Body.Html.Data'] = html_body
if text_body is not None:
params['Message.Body.Text.Data'] = text_body
- else:
+
+ if(format not in ("text","html")):
raise ValueError("'format' argument must be 'text' or 'html'")
+
+ if(not (html_body and text_body)):
+ raise ValueError("No text or html body found for mail")
self._build_list_params(params, to_addresses,
'Destination.ToAddresses.member')