Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email Encryption #443

Open
raziel057 opened this issue Aug 24, 2022 · 0 comments
Open

Email Encryption #443

raziel057 opened this issue Aug 24, 2022 · 0 comments

Comments

@raziel057
Copy link
Contributor

Hello,

What do you think about providing an option to encrypt emails when using the Symfony MailerHandler? As described here
https://symfony.com/doc/current/mailer.html#encrypting-messages

It's often very useful to be notified by email about errors in an application as described here: https://symfony.com/doc/current/logging/monolog_email.html but in the same time sending emails with technical / sensible information can be seen as security risk and pointed by auditors.

It seems to me it would be possible to add an encrypt_certif option to provide a crt that can be used by the handler to encrypt the emails.

If the encrypt_certif is a valid certificate, it can be passed to the MailerHandler (monolog-bridge) and then used in the send method like this:

protected function send(string $content, array $records)
    {
        //$this->mailer->send($this->buildMessage($content, $records));
        $message = $this->buildMessage($content, $records);

        if ($this->certifEncrypt !== null) {
            $encrypter = new SMimeEncrypter($this->certifEncrypt);
            $this->mailer->send($encrypter->encrypt($message));
        } else {
            $this->mailer->send($message);
        }
    }

What do you think about this idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant