1
2
3
 
 

I am learning how to use Symfony Mailer and am a bit lost on the encrypting message section.

This is my simple code below which works in sending the email.

<?php

require 'vendor/autoload.php';

const FROM = 'me@example.com';

const TO = 'example@email.com';

const SUBJECT = 'My Subject';

const MESSAGE = 'Hello World';

const DSN = 'smtp://localhost:1025';

$transport = \Symfony\Component\Mailer\Transport::fromDsn(DSN);

$mailer = new \Symfony\Component\Mailer\Mailer($transport);

$email = (new \Symfony\Component\Mime\Email())
    ->from(FROM)
    ->to(TO)
    ->subject(SUBJECT)
    ->text(MESSAGE);

$encrypter = new \Symfony\Component\Mime\Crypto\SMimeEncrypter('my-certificate.crt');
$encryptedEmail = $encrypter->encrypt($email);

try {
    $mailer->send($encryptedEmail);
} catch (\Symfony\Component\Mailer\Exception\TransportExceptionInterface $error) {
    echo 'Unable to send email' . PHP_EOL;
}

And this is how I generated the certificate and key...

openssl genrsa -aes256 -out my-certificate.key 4096
openssl req -new -x509 -days 29220 -key my-certificate.key -out my-certificate.crt

I am able to receive the email using SMTP tools like Mailpit.

My two questions are...

  1. My emails are encrypted using the certificate, but shouldn't it be done using PGP?
  2. How do I decrypt the email with SMTP testing tool or any online or CLI tool? I tried to decrypt the email and could not decrypt it even though I have all of the keys.
4
5
6
7
8
9
10
11
submitted 2 months ago by to c/symfony@programming.dev
12
13
submitted 2 months ago by to c/symfony@programming.dev
14
15
16
17
 
 

Symfony UX 2.x is now in security-only maintenance mode. Going forward, all new features and bug fixes will target Symfony UX 3.x

18
19
submitted 2 months ago by to c/symfony@programming.dev
 
 

Twig 3.26.0 is a security release fixing 13 advisories, with two rated critical, three high, four medium, and four low. Almost all of them target the sandbox, the component that lets applications run untrusted templates under an explicit allow-list of tags, filters, functions, properties, and methods. All users running untrusted templates through the sandbox should upgrade immediately.

20
21
22
submitted 2 months ago by to c/symfony@programming.dev
23
24
25
view more: next ›