Skip to content

Instantly share code, notes, and snippets.

@lparolari
Created July 5, 2019 12:19
Show Gist options
  • Save lparolari/8f9bed3b6a4ed12c0635f9c9401e004f to your computer and use it in GitHub Desktop.
Save lparolari/8f9bed3b6a4ed12c0635f9c9401e004f to your computer and use it in GitHub Desktop.
Symfony troubleshooting: awesome tips

Symfony Troubleshooting

SwiftMailer

Symfony has a nice mailing system provided as a plug-and-play package, but sometime some tweaks are needed.

Error Management

The swiftmailer do not fire exceptions, instead the send(message) method returns the number of successful recipients that can be zero (representing an issue). However, another sent method exists: sent(message, failedRecipients) which returns the list of failed email addresses.

Keep in mind that this errors are usually not catched during the normal code execution because the email sending is spooled.

Checks

The swiftmailer checks the from address and the to address, comporting a failure if this addresses are fake. Keep this in mind when you do functional testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment