示例#1
0
 def send_email(self,
                to_name,
                to_field,
                from_name,
                from_field,
                subject_field,
                body_text):
     return requests.post(
         self.server,
         auth=("api", self.api_key),
         data={"from": "%s <%s>" % (from_name, from_field),
               "to": "%s <%s>" % (to_name, to_field),
               "subject": subject_field,
               "text": strip_tags(body_text)})
示例#2
0
 def send_email(self,
                to_name,
                to_field,
                from_name,
                from_field,
                subject_field,
                body_text):
     payload = {
         'key': self.api_key,
         'message': {
             'text': strip_tags(body_text),
             'subject': subject_field,
             'from_email': from_field,
             'to': [{'email': to_field}]
         }
     }
     return requests.post(self.server, data=json.dumps(payload))
示例#3
0
 def test_html_strip(self):
     from util.html_tools import strip_tags
     self.assertEqual(strip_tags(self.html), 'test')