"""Utils for Datalytics Workflows.""" import boto3 from feed_ingestion.conf.config import BOTO3_CONFIG def send_emails(to, sub, body): """ Send an email from datarequests to whomever. Make sure the to is a list, sub and body are strings. """ client = boto3.client('ses', config=BOTO3_CONFIG) FROM = 'datarequests@theorchard.com' response = client.send_email( Source=FROM, Destination={ 'ToAddresses': to }, Message={ 'Subject': { 'Data': sub, 'Charset': 'UTF-8' }, 'Body': { 'Text': { 'Data': body, 'Charset': 'UTF-8' } } } ) return response