Problem/Motivation

The SwiftMailer module gave the option to send a test email to ensure everything was working fine with the configuration. Is there or are there any plans to do something similar with the Symfony Mailer Drupal module?

Steps to reproduce

n/a

Proposed resolution

Perhaps add a page to the Symfony Mailer Configuration that allows for entering an email address to send a test email to.

Remaining tasks

n/a

User interface changes

This is what the screen currently looks like in SwiftMailer. So maybe we could mimic the same screen in Symfony Mailer.

Screenshot of SwiftMailer Test config page

API changes

n/a

Data model changes

n/a

Comments

axle_foley00 created an issue. See original summary.

adamps’s picture

Version: 1.0.0-alpha3 » 1.x-dev

Thanks for raising. I absolutely agree it is a feature I would like to see. Patches welcome.

ccsjunio’s picture

merlin06’s picture

StatusFileSize
new4.21 KB

Add symfony_mailer test form.

merlin06’s picture

StatusFileSize
new4.94 KB

Updated patch.

adamps’s picture

Status: Active » Needs review

Great thanks I'll take a look soon

adamps’s picture

Status: Needs review » Needs work

Great thanks, here are my comments:

  1. You don't need to set from, transport or langcode - they should happen automatically.
  2. Email class has a send() method so you don't need to access the mailer
  3. Instead of setting a fixed subject and body in code, we should create a default mailer policy. Look at symfony_mailer.mailer_policy.user.cancel_confirm.yml and do something similar. The body should be HTML. Let's make the subject and body text a little neater
  4. You can 'chain' the calls to email: $email = $this->emailFactory->newModuleEmail()->setTo()->send()
  5. Please create an EmailBuilder. It will not have any code! However the @EmailBuilder comment is important so that the sub_type is registered.
adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new9.85 KB
new4.65 KB
adamps’s picture

StatusFileSize
new6.06 KB

Sorry the first patch file was polluted by some other commits

  • AdamPS committed 2324091 on 1.x
    Issue #3255835 by merlin06, AdamPS, axle_foley00: Send Test Email
    
adamps’s picture

Status: Needs review » Fixed
adamps’s picture

Status: Fixed » Needs review
StatusFileSize
new360 bytes

PHP 7.3 compatibility

Status: Needs review » Needs work

The last submitted patch, 12: symfony_mailer.test-email.3255835-12.patch, failed testing. View results

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new2.07 KB
  • PHP 7.3 compatibility
  • use EmailFactoryInterface,
  • Rename to TestEmailForm (TestForm makes my imagine it's part of the test code)

Status: Needs review » Needs work

The last submitted patch, 14: symfony_mailer.test-email.3255835-14.patch, failed testing. View results

  • AdamPS committed 0d0f1f2 on 1.x
    Issue #3255835 by AdamPS, merlin06, axle_foley00: Send Test Email (...
adamps’s picture

Status: Needs work » Fixed

Test failure is unrelated so will commit.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rgpublic’s picture

Um, it's really cool that we now have the test mail functionality (thanks a lot!), but I still get: "Missing email transport: please configure a default." Why?