MailChimp avatar MailChimp committed 6d3353b

Add the from_email, from_name, and to parameters to messages/send-raw to override the data provided in the raw SMTP document

Comments (0)

Files changed (2)

         params = json.dumps(params)
         self.log('POST to %s%s.json: %s' % (ROOT, url, params))
         start = time.time()
-        r ='%s%s.json' % (ROOT, url), data=params, headers={'content-type': 'application/json', 'user-agent': 'Mandrill-Python/1.0'})
+        r ='%s%s.json' % (ROOT, url), data=params, headers={'content-type': 'application/json', 'user-agent': 'Mandrill-Python/1.0.2'})
             remote_addr = r.raw._original_response.fp._sock.getpeername() # grab the remote_addr before grabbing the text since the socket will go away
         _params = {'raw_message': raw_message}
         return'messages/parse', _params)
-    def send_raw(self, raw_message):
+    def send_raw(self, raw_message, from_email=None, from_name=None, to=None):
         """Take a raw MIME document for a message, and send it exactly as if it were sent over the SMTP protocol
            raw_message (string): the full MIME document of an email message
+           from_email (string|null): optionally define the sender address - otherwise we'll use the address found in the provided headers
+           from_name (string|null): optionally define the sender alias
+           to (array|null): optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document::
+               to[] (string): the email address of the recipint
            array.  of structs for each recipient containing the key "email" with the email address and "status" as either "sent", "queued", or "rejected"::
                [] (struct): the sending results for a single recipient::
                    [].email (string): the email address of the recipient
-                   [].status (string): the sending status of the recipient - either "sent", "queued", or "rejected"
+                   [].status (string): the sending status of the recipient - either "sent", "queued", "rejected", or "invalid"
            InvalidKeyError: The provided API key is not a valid Mandrill API key
            Error: A general Mandrill error has occurred
-        _params = {'raw_message': raw_message}
+        _params = {'raw_message': raw_message, 'from_email': from_email, 'from_name': from_name, 'to': to}
         return'messages/send-raw', _params)
     name = 'mandrill',
-    version = '1.0.1',
+    version = '1.0.2',
     author = 'Mandrill Devs',
     author_email = '',
     description = 'A CLI client and Python API library for the Mandrill email as a service platform.',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.