removing personal email address
and making contents a simple string
This commit is contained in:
@@ -3,20 +3,17 @@ from sendgrid.helpers.mail import Mail, Email, To, Content
|
||||
|
||||
def handle_storage_event(event, context):
|
||||
|
||||
from_email = Email("masif.72@gmail.com")
|
||||
to_emails = To("masif.carleton@gmail.com")
|
||||
from_email = Email("from_email@gmail.com")
|
||||
to_emails = To("to_email@gmail.com")
|
||||
subject = "Your Storage Bucket Notification"
|
||||
content = Content("text/plain",
|
||||
f"Bucket Impacted:{event['bucket']} \n" +
|
||||
f"File Impacted: {event['name']} \n " +
|
||||
f"Event Time: {event['timeCreated']} \n" +
|
||||
f"Event ID: {context.event_id} \n" +
|
||||
content = f"Bucket Impacted:{event['bucket']} \n" + \
|
||||
f"File Impacted: {event['name']} \n " + \
|
||||
f"Event Time: {event['timeCreated']} \n" + \
|
||||
f"Event ID: {context.event_id} \n" + \
|
||||
f"Event Type: {context.event_type}"
|
||||
)
|
||||
|
||||
mail = Mail(from_email, to_emails, subject, content)
|
||||
mail_json = mail.get()
|
||||
|
||||
sg = SendGridAPIClient()
|
||||
response = sg.client.mail.send.post(request_body=mail_json)
|
||||
|
||||
print(response.status_code) # for logging purpose
|
||||
print(response.headers)
|
||||
|
||||
Reference in New Issue
Block a user