You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my project I have the option to send an email if the event ends successfully and the option to send if a failure occurs, using. The user can choose both or neither.
I do an if to check the user's choice, like this:
if ($schedule->sendmail_success) {
$event->emailOutputTo($schedule->email);
}
if ($schedule->sendmail_error) {
$event->emailOutputOnFailure($schedule->email);
}
If the user wants to receive all outputs and there is a failure, the email is sent twice, the emailOutputTo is called twice. (In this case it is simple to solve, just use the emailOutputTo because this method doesn't care about the result).
But, if the user wants to receive only the successful outputs, and an error occurs in the process, he receives the email anyway, because the emailOutputTo does not make this distinction.
Possible solution
To solve this little problem I believe an emailOutputOnSuccessTo method solves it. So the class would have 3 methods to send email with the output:
emailOutputTo -> send the output regardless of the result
emailOutputOnFailureTo -> send output only on failure
emailOutputOnSuccessTo -> send output only on success
The text was updated successfully, but these errors were encountered:
Description:
In my project I have the option to send an email if the event ends successfully and the option to send if a failure occurs, using. The user can choose both or neither.
I do an if to check the user's choice, like this:
If the user wants to receive all outputs and there is a failure, the email is sent twice, the
emailOutputTo
is called twice. (In this case it is simple to solve, just use theemailOutputTo
because this method doesn't care about the result).But, if the user wants to receive only the successful outputs, and an error occurs in the process, he receives the email anyway, because the
emailOutputTo
does not make this distinction.Possible solution
To solve this little problem I believe an
emailOutputOnSuccessTo
method solves it. So the class would have 3 methods to send email with the output:emailOutputTo
-> send the output regardless of the resultemailOutputOnFailureTo
-> send output only on failureemailOutputOnSuccessTo
-> send output only on successThe text was updated successfully, but these errors were encountered: