a ,"?gO@sddlZddlmZddlZddlZddlmZddlmZm Z m Z m Z m Z m Z mZmZmZmZmZmZdZejdejejejdZejejdZed Zed Zed Zed Z ed Z!Gddde"Z#dS)N)Template)Config) AsmContentEmailMailTo AttachmentFileNameFileType Disposition FileContentGroupIdGroupsToDisplayMessage from SPARC Portalses)aws_access_key_idaws_secret_access_key region_name)api_keyzcThank you for your feedback on the SPARC Portal!

Your message:

$message zaThank you for reporting the following error/issue on the SPARC Portal!

$message zThank you for expressing interest in a SPARC service! We have received your request and will be in contact as soon as possible.

Your message:

$message zThank you for your submission to SPARC! We have received your question/inquiry and will be in contact as soon as possible.

Your message:

$message zThank you for the following SPARC submission! We have received your request and will be in contact as soon as possible.

Your submission:

$message c@s4eZdZddZddZddZddZd d Zd S) EmailSendercCs<d|_d|_tj|_tj|_d|_tjdkr8t tj|_dS)NrzUTF-8r) default_subjectcharsetr SES_SENDER ses_senderSES_ARNses_arnunsubscribe_group(SENDGRID_MONTHLY_STATS_UNSUBSCRIBE_GROUPint)selfr"C/home/cmiss/Jenkins/workspace/SPARC-API-DEV/scripts/email_sender.py__init__Fs zEmailSender.__init__cCsR|d|d|}tj|jd|jgi|j|jdd|j|did|jddS)N Z ToAddresses)CharsetZDataText)ZSubjectBody)SourceZ DestinationMessageZ SourceArn) ses_client send_emailrrrr)r!name email_addressmessagebodyr"r"r#r,Os  zEmailSender.send_emailc Cstt|t||td|}tt|t|t|td} | |_ t |} t d|dt d|d| jd| j| S)N text/html attachment Sending a 'z%' mail with attachment using SendGridMail to  response Status code: r%)rrrrr r r r r r2 sg_clientsendlogginginfodebug status_coder0) r!frommtosubjectr0Z encoded_file file_name file_typemailZ attachedFileresponser"r"r#sendgrid_email_with_attachment\s"  z*EmailSender.sendgrid_email_with_attachmentcCs\tt|t||td|}t|}td|dtd|d|j d|j |SNr1r3z' mail using SendGridr4r5r%) rrrrr6r7r8r9r:r;r0r!r<r=r>r0rArBr"r"r#sendgrid_emailps  zEmailSender.sendgrid_emailcCsvtt|t||td|}tt|jt|jg|_t |}t d|dt d|d|jd|j|SrD)rrrrrrrrZasmr6r7r8r9r:r;r0rEr"r"r#%sendgrid_email_with_unsubscribe_group|s  z1EmailSender.sendgrid_email_with_unsubscribe_groupN)__name__ __module__ __qualname__r$r,rCrFrGr"r"r"r#rEs    r)$r8stringrboto3Zsendgrid app.configrZsendgrid.helpers.mailrrrrrr r r r r rrr>clientSPARC_PORTAL_AWS_KEYSPARC_PORTAL_AWS_SECRET AWS_REGIONr+ZSendGridAPIClientSENDGRID_API_KEYr6feedback_emailissue_reporting_emailservice_interest_emailgeneral_interest_email#creation_request_confirmation_emailobjectrr"r"r"r#s&  8