Hello,
I would like there to be a checkbox available to send a Confirmation email to the filedrop sender when they send.
There should be a corresponding email template that is used that looks almost exactly like the message received by the recipient but it would say "Filedrop Submission Confirmation" across the top.
It would not have a "Download files" or a "view message" button.
I am using a python action script to accomplish this right now but the resulting email is not very nice looking. It would be better to have a built in option.
I would like there to be a checkbox available to send a Confirmation email to the filedrop sender when they send.
There should be a corresponding email template that is used that looks almost exactly like the message received by the recipient but it would say "Filedrop Submission Confirmation" across the top.
It would not have a "Download files" or a "view message" button.
I am using a python action script to accomplish this right now but the resulting email is not very nice looking. It would be better to have a built in option.
Code:
#!/usr/bin/env python3
import json
import sys
import subprocess
jsonfile = sys.argv[1]
notificationbody=""
# Load JSON data from the file passed as the first argument
with open(sys.argv[1], 'r') as file:
message_data = json.load(file)
# Get sender address
sender = message_data["sender"]
# Get recipients address. This is an array that includes other fields; we only want the first field.
recipient = message_data["recipients"][0]
# Get Message subject
subject = message_data["subject"]
# Get message content including custom fields
messagetxt = message_data["message"]
# Get time message was created
created_time = message_data["created_at"]
# Replace ":" characters with "-" characters
created_time = created_time.replace(":", ".")
# Replace "T" with " " to separate date from time more clearly
created_time = created_time.replace("T", " ")
# Delete last 7 characters from timestamp (timezone)
created_time = created_time[:-7]
notificationbody = "Confirmation of Filedrop Submission\n\n"
notificationbody = f"{notificationbody}Sender: {sender}\n"
notificationbody = f"{notificationbody}Recipient: {recipient}\n"
notificationbody = f"{notificationbody}Time of submission: {created_time}\n"
notificationbody = f"{notificationbody}Submitted Files:\n\n"
# Iterate through attachments
for attachment in message_data["attachments"]:
notificationbody = f"{notificationbody}\tFilename: {attachment['filename']}\n\tSize: {attachment['size_human']}\n\tChecksum: {attachment['checksum']}\n\n"
notificationbody = f"{notificationbody}Included Details:\n\nSubject: {subject}\n{messagetxt}"
emailcommand = f"""/usr/sbin/sendmail -F 'DISPLAY NAME OF EMAIL SENDER' -f email@address.that.the.message.should.come.from.example.com -t < /usr/bin/cat <<EOF
Subject: Filedrop submission confirmation
To: {sender}
{notificationbody}
.
EOF"""
subprocess.run(emailcommand, shell=True, check=True)
Last edited: