def send_raw_email(email_obj, from_address, subject, content_html, send_after = None, just_prepare=False): ''' Method to generically send a raw email with merge data. Use this method in your own apps to be able to track single emails. Could be for notifications or acknowledgements of events. This is a one off type email. ''' email_list = EmailList() email_list.name = '%s - %s' %(str(datetime.datetime.now()),str(email_obj.email)) email_list.data_raw_emails = email_obj.email email_list.is_oneoff = True email_list.type = EmailList.LISTTYPE_RAW_EMAILS email_list.save() email_blast = EmailBlast() email_blast.name = subject+ ' '+str(datetime.datetime.today().strftime("%Y-%b-%d-%m")) email_blast.send_after = send_after if send_after else datetime.datetime.now() email_blast.from_address = from_address email_blast.subject = subject email_blast.html = content_html email_blast.save() email_blast.lists.add(email_list) email_blast.save() email_blast.send(just_prepare)