<reponame>Eric-Muthemba/qontroverse
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail



def send_email(subject, sender, recipients, text_body, html_body,
               attachments=None, sync=False):
    print(str(sender))
    message = Mail(
        from_email=str(sender),
        to_emails=str(recipients[0]),
        subject=subject,
        html_content=str(html_body))

    try:
        sg = SendGridAPIClient('<KEY>')
        response = sg.send(message)
        print(response.status_code)
        print(response.body)
        print(response.headers)
    except Exception as e:
        print(e.message)

from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail



def send_email(subject, sender, recipients, text_body, html_body,
               attachments=None, sync=False):
    print(str(sender))
    message = Mail(
        from_email=str(sender),
        to_emails=str(recipients[0]),
        subject=subject,
        html_content=str(html_body))

    try:
        sg = SendGridAPIClient('<KEY>')
        response = sg.send(message)
        print(response.status_code)
        print(response.body)
        print(response.headers)
    except Exception as e:
        print(e.message)