Home > Forum > General > Can we save sent e-mails as attachments?

Can we save sent e-mails as attachments?
2

MVP

Hi Dan,

I have only two ideas for workarounds.

1. Recreate the e-mails
The data about the send mails ist stored in the tables WFMails and WFMailAttachments. Therefore you could create an SDK action, which takes the values from the tables and create the .eml file yourself and attach it to the workflow. Potential drawback: Adding the created mail attachment using the SDK may not trigger the internal functionality to update the mail related fields in WFDataAttachmets. So the attached mail may be listed under attachments instead of mail in the UI.

2. Copy the mail after sending them
The mails are send via SMTP to a server. So we probably could either configure the target server or setup an intermediate server to copy the created mail on file system level/send a copy to another address. In this case we could either use Hotfolders or HotMailboxes to check for new mails which need to be added to the workflow id in the subject.

Yes, these are only guesses on my part and I would test the first approach. Create an action which copies the binary data of an existing mail attachment to a new attachment and add this to the workflow instance. If this works as expected, creating the .eml file based on SQL data will be doable.


Best regards,
Daniel

MVP
In reply to: Dan Popescu - ENCORSA Romania

Thank you very much, I will try the first method. I don't mind where the attachment is placed in the UI because I will send it to my process that saves it in the SharePoint :).

Have a nice day!

Hi Dan,

which version of SharePoint are you targeting?

If it's an older one you could enable incoming mails for document libraries and send the mail directly to it:
https://support.microsoft.com/en-us/office/enable-incoming-e-mail-support-for-a-list-or-library-dcaf44a0-1d9b-451a-84c7-6c52e7db908e

Alternative for SPO with a flow:
https://www.arrayasolutions.com/step-by-step-bring-incoming-email-to-your-sharepoint-online-instance/

If you already considered these option and decided against them, I can understand it. After all you would add another point of failure and one which isn't logged within the workflow history. :)

Best regards,
Daniel

In reply to: Razvan Ogrezeanu - ENCORSA Romania

As we needed the functionality for auditing and legal purposes, whe have decided to create a hotmailbox on the Sent folder. Apparently that can be done. Doing it in this way, the email attached was a legitimate copy of the one that was acutally sent. with all the proper metadata.

Dear Razvan.

I have a questions regarding your statement: "... have decided to create a hotmailbox on the Sent folder."

What "sent" folder are you referring to? In our set-up the Webcon System account has no Exchange-mailbox, but sends directly.


Have you created a "Webcon user account" including mailbox or have you found another solution?


Kind regards
Klaus