Problem/Motivation

I have error

Error sending email: Expected response code "354" but got code "550", with message "550 Your message contains 0 valid recipients.".

and I want to handle it.
But I haven't found how I able to do it: there is no hook or something else.

Proposed resolution

Add EmailInterface::getError() which returns the message from the exception if there was an error.

Comments

super_romeo created an issue. See original summary.

super_romeo’s picture

Issue summary: View changes
adamps’s picture

Good point. Please can you explain a bit more about what you'd like to be able to do?

super_romeo’s picture

I want to know what email message caused the error and error message.
To check this email address for sending problems on my mail-provider.
This email address can be blocked or "Mailbox size limit exceeded" or something like that.

adamps’s picture

There is already a function EmailProcessorInterface::postSend() or hook_mailer_post_send().

But there is currently no way to see the error message in this hook. We could add EmailInterface::getError() which returns the message from the exception if there was an error. Does that give you what you need?

super_romeo’s picture

Sure.
Thank you, @AdamPS!

adamps’s picture

Issue summary: View changes
adamps’s picture

Title: Ability to handle email sending errors » Add function to get email error message
adamps’s picture

Status: Active » Needs review
StatusFileSize
new5.21 KB

Status: Needs review » Needs work

The last submitted patch, 9: symfony_mailer.email-error.3337359-9.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new5.34 KB
new967 bytes

Fixing coding standards issues in patch #9, please review it.

Status: Needs review » Needs work

The last submitted patch, 11: symfony_mailer.email-error.3337359-11.patch, failed testing. View results

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new8.86 KB
new6.38 KB

Thanks for #11

  • AdamPS committed 12497263 on 1.x
    Issue #3337359 by AdamPS, mrinalini9: Add function to get email error...
adamps’s picture

Status: Needs review » Fixed
super_romeo’s picture

Thank you very much, Adam!

Status: Fixed » Closed (fixed)

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