def update(self, new_email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False): """Updates any aspect of a subscriber, including email address, name, and custom field data if supplied.""" validate_consent_to_track(consent_to_track) params = {"email": self.email_address} body = { "EmailAddress": new_email_address, "Name": name, "CustomFields": custom_fields, "Resubscribe": resubscribe, "ConsentToTrack": consent_to_track, "RestartSubscriptionBasedAutoresponders": restart_subscription_based_autoresponders } response = self._put("/subscribers/%s.json" % self.list_id, body=json.dumps(body), params=params) # Update self.email_address, so this object can continue to be used # reliably self.email_address = new_email_address
def add(self, list_id, email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False): """Adds a subscriber to a subscriber list.""" validate_consent_to_track(consent_to_track) body = { "EmailAddress": email_address, "Name": name, "CustomFields": custom_fields, "Resubscribe": resubscribe, "ConsentToTrack": consent_to_track, "RestartSubscriptionBasedAutoresponders": restart_subscription_based_autoresponders } response = self._post("/subscribers/%s.json" % list_id, json.dumps(body)) return json_to_py(response)
def add(self, list_id, email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False): """Adds a subscriber to a subscriber list.""" validate_consent_to_track(consent_to_track) body = { "EmailAddress": email_address, "Name": name, "CustomFields": custom_fields, "Resubscribe": resubscribe, "ConsentToTrack": consent_to_track, "RestartSubscriptionBasedAutoresponders": restart_subscription_based_autoresponders} response = self._post("/subscribers/%s.json" % list_id, json.dumps(body)) return json_to_py(response)
def update(self, new_email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False): """Updates any aspect of a subscriber, including email address, name, and custom field data if supplied.""" validate_consent_to_track(consent_to_track) params = {"email": self.email_address} body = { "EmailAddress": new_email_address, "Name": name, "CustomFields": custom_fields, "Resubscribe": resubscribe, "ConsentToTrack": consent_to_track, "RestartSubscriptionBasedAutoresponders": restart_subscription_based_autoresponders} response = self._put("/subscribers/%s.json" % self.list_id, body=json.dumps(body), params=params) # Update self.email_address, so this object can continue to be used # reliably self.email_address = new_email_address
def classic_email_send(self, subject, from_address, to, consent_to_track, client_id=None, cc=None, bcc=None, html=None, text=None, attachments=None, track_opens=True, track_clicks=True, inline_css=True, group=None, add_recipients_to_list=None): """Sends a classic email.""" validate_consent_to_track(consent_to_track) body = { "Subject": subject, "From": from_address, "To": to, "CC": cc, "BCC": bcc, "HTML": html, "Text": text, "Attachments": attachments, "TrackOpens": track_opens, "TrackClicks": track_clicks, "InlineCSS": inline_css, "Group": group, "AddRecipientsToList": add_recipients_to_list, "ConsentToTrack": consent_to_track, } if client_id is None: response = self._post("/transactional/classicEmail/send", json.dumps(body)) else: response = self._post( "/transactional/classicEmail/send?clientID=%s" % client_id, json.dumps(body)) return json_to_py(response)
def smart_email_send(self, smart_email_id, to, consent_to_track, cc=None, bcc=None, attachments=None, data=None, add_recipients_to_list=None): """Sends the smart email.""" validate_consent_to_track(consent_to_track) body = { "To": to, "CC": cc, "BCC": bcc, "Attachments": attachments, "Data": data, "AddRecipientsToList": add_recipients_to_list, "ConsentToTrack": consent_to_track, } response = self._post( "/transactional/smartEmail/%s/send" % smart_email_id, json.dumps(body)) return json_to_py(response)