def send_email(subject, body, from_email, to, cc=None, fail_silently=False, html=False): """ Use django.core.mail.EmailMessage to send and log an Atmosphere email. """ try: msg = EmailMessage(subject=subject, body=body, from_email=from_email, to=to, cc=cc) if html: msg.content_subtype = 'html' msg.send(fail_silently=fail_silently) email_logger.info("Email Sent." + "From:%s\nTo:%sCc:%s\nSubject:%s\nBody:\n%s" % (from_email, to, cc, subject, body)) return True except Exception as e: logger.error(e) return False
def send_email(subject, body, from_email, to, cc=None, fail_silently=False, html=False): """ Use django.core.mail.EmailMessage to send and log an Atmosphere email. """ try: msg = EmailMessage(subject=subject, body=body, from_email=from_email, to=to, cc=cc) if html: msg.content_subtype = 'html' log_message = "\n> From:{0}\n> To:{1}\n> Cc:{2}\n> Subject:{3}\n> Body:\n{4}" args = (from_email, to, cc, subject, body) email_logger.info(log_message.format(*args)) msg.send(fail_silently=fail_silently) return True except Exception as e: celery_logger.exception(e) return False
def send_email(subject, body, from_email, to, cc=None, fail_silently=False, html=False): """ Use django.core.mail.EmailMessage to send and log an Atmosphere email. """ try: msg = EmailMessage(subject=subject, body=body, from_email=from_email, to=to, cc=cc) if html: msg.content_subtype = 'html' msg.send(fail_silently=fail_silently) args = (from_email, to, cc, subject, body) email_logger.info(log_message.format(*args)) return True except Exception as e: celery_logger.exception(e) return False
def send_email(subject, body, from_email, to, cc=None, fail_silently=False, html=False): """ Use django.core.mail.EmailMessage to send and log an Atmosphere email. """ try: msg = EmailMessage(subject=subject, body=body, from_email=from_email, to=to, cc=cc) if html: msg.content_subtype = 'html' msg.send(fail_silently=fail_silently) args = (from_email, to, cc, subject, body) email_logger.info(log_message.format(*args)) return True except Exception as e: logger.error(e) return False
def send_email(subject, body, from_email, to, cc=None, fail_silently=False, html=False): """ Use django.core.mail.EmailMessage to send and log an Atmosphere email. """ try: msg = EmailMessage(subject=subject, body=body, from_email=from_email, to=to, cc=cc) if html: msg.content_subtype = 'html' log_message = "\n> From:{0}\n> To:{1}\n> Cc:{2}\n> Subject:{3}\n> Body:\n{4}" args = (from_email, to, cc, subject, body) email_logger.info(log_message.format(*args)) if getattr(settings, "SEND_EMAILS", True): msg.send(fail_silently=fail_silently) email_logger.info("NOTE: Above message sent successfully") celery_logger.info("NOTE: Above message sent successfully") else: email_logger.info("NOTE: Above message not sent -- SEND_EMAILS was False") celery_logger.info("NOTE: Above message not sent -- SEND_EMAILS was False") return True except Exception as e: celery_logger.exception(e) return False
def send_email(subject, body, from_email, to, cc=None, fail_silently=False, html=False): """ Use django.core.mail.EmailMessage to send and log an Atmosphere email. """ try: msg = EmailMessage(subject=subject, body=body, from_email=from_email, to=to, cc=cc) if html: msg.content_subtype = 'html' email_logger.info("\n> From:%s\n> To:%s\n> Cc:%s\n> Subject:%s\n> Body:\n%s", from_email, to, cc, subject, body) if getattr(settings, "SEND_EMAILS", True): msg.send(fail_silently=fail_silently) email_logger.info("NOTE: Above message sent successfully") celery_logger.info("NOTE: Above message sent successfully") else: email_logger.info("NOTE: Above message not sent -- SEND_EMAILS was False") celery_logger.info("NOTE: Above message not sent -- SEND_EMAILS was False") return True except Exception as e: celery_logger.exception(e) return False
def send_email(subject, body, from_email, to, cc=None, html=False): """ Use django.core.mail.EmailMessage to send and log an Atmosphere email. """ try: msg = EmailMessage(subject=subject, body=body, from_email=from_email, to=to, cc=cc) if html: msg.content_subtype = 'html' email_logger.info( "\n> From:%s\n> To:%s\n> Cc:%s\n> Subject:%s\n> Body:\n%s", from_email, to, cc, subject, body) if getattr(settings, "SEND_EMAILS", True): msg.send() email_logger.info("NOTE: Above message sent successfully") celery_logger.info("NOTE: Above message sent successfully") else: email_logger.info( "NOTE: Above message not sent -- SEND_EMAILS was False") celery_logger.info( "NOTE: Above message not sent -- SEND_EMAILS was False") return True except Exception as e: celery_logger.exception(e) return False