Exemplo n.º 1
0
 def create_draft(self, preview_recipients=[]):
     campaign = CSCampaign(auth=settings.CREDENTIALS)
     attrs = dict(
         client_id=settings.CLIENT_ID,
         subject=self.subject,
         name=self.name,
         from_name=self.from_name,
         from_email=self.from_email,
         reply_to=self.from_email, # TODO
         html_url=self.html_url,
         text_url=self.text_url,
         list_ids=self.list_ids,
         segment_ids=self.segment_ids,
     )
     try:
         campaign_id = campaign.create(**attrs)
         self.cm_id = campaign_id
         self.status = self.STATUS_DRAFT
         self.save()
     except BadRequest, e:
         raise
 def create_draft(self, preview_recipients=[]):
     CreateSend.api_key = settings.API_KEY
     campaign = CSCampaign()
     attrs = dict(
         client_id=settings.CLIENT_ID,
         subject=self.subject,
         name=self.name,
         from_name=self.from_name,
         from_email=self.from_email,
         reply_to=self.from_email,  # TODO
         html_url=self.html_url,
         text_url=self.text_url,
         list_ids=self.list_ids,
         segment_ids=self.segment_ids,
     )
     try:
         campaign_id = campaign.create(**attrs)
         self.cm_id = campaign_id
         self.status = self.STATUS_DRAFT
         self.save()
     except BadRequest, e:
         raise
Exemplo n.º 3
0
 def create_draft(self, preview_recipients=[]):
     campaign = CSCampaign(auth=settings.CREDENTIALS)
     attrs = dict(
         client_id=settings.CLIENT_ID,
         subject=self.subject,
         name=self.name,
         from_name=self.from_name,
         from_email=self.from_email,
         reply_to=self.from_email, # TODO
         html_url=self.html_url,
         text_url=self.text_url,
         list_ids=self.list_ids,
         segment_ids=self.segment_ids,
     )
     try:
         campaign_id = campaign.create(**attrs)
         self.cm_id = campaign_id
         self.status = self.STATUS_DRAFT
         self.save()
     except BadRequest as e:
         raise
     if len(preview_recipients):
         campaign = CSCampaign(auth=settings.CREDENTIALS, campaign_id=campaign_id)
         campaign.send_preview(preview_recipients)