0

Is it possible to send encrypted email using the Database Mail component of SQL Server? I'm looking into adding encryption support to a system that currently uses Database Mail for sending out emails. S/MIME is preferable, but PGP is also OK.

If this isn't possible, I guess I will need to alter the architecture and add an extra component that handles sending emails (either an entirely separate program or an SQLCLR stored procedure). Do you have a recommendation for a C#/.NET library for this purpose?

Filip
  • 1,451
  • 1
  • 11
  • 19
  • 3
    Database Mail is meant for relatively simple jobs, mainly sending alerts or data reports. It's not a full-blown mailer. It's not just encryption - how do you handle sending 1000 emails without getting banned by the server? How about rich emails? That's what libraries like [Coravel](https://www.hanselman.com/blog/exploring-the-net-core-library-coravel-for-task-scheduling-caching-mailing-and-more) or [HangFire](https://www.hangfire.io/) are for. – Panagiotis Kanavos Apr 05 '21 at 09:57
  • Don't do it... its not the right place. – Dale K Apr 05 '21 at 10:14
  • Oh look what the google dragged in [Sending S/MIME Encrypted Email](https://www.example-code.com/sql/smtp_sendEncryptedCer.asp) - but don't do it. – Dale K Apr 05 '21 at 10:19
  • @PanagiotisKanavos The emails that are being sent are actually alerts and reports and the number of emails sent is not that big. I had a look at Coravel and HangFire, but I didn't find anything about sending encrypted email. They do look interesting, though, I guess they could replace some things we do now with services/scheduled tasks. For the email encryption I'm leaning towards using MimeKit. – Filip Apr 05 '21 at 16:06

0 Answers0