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
Before the Message::generateMessage() method gets called, there is already some communication with the SMTP server. If the method for some reason throws an exception other than Nette\Mail\SmtpException, sending the message aborts but the connection is kept open. If you send another message using the same sender, the SMTP server will probably return something like 503 sender already given because from its point of view you are still sending the first faulty message.
How can this happen: Using vanilla Nette\Mail\Message it probably can't. However because of how the Message builds itself when being sent and because the $parts property is private, it is impossible to build a wrapper/proxy/decorator/something that would encapsulate an existing message and encrypt/sign it for example. The only feasible way I've found is a to subclass the Message class and handle the signature/encryption part inside the build() method. And this can obviously fail. And if it throws something else than Nette\Mail\SmtpException GO TO previous paragraph.
The fix is simple - only change the order of things inside SmtpSender::send(). PR #43 present.
Steps To Reproduce
Throw an exception (any other than Nette\Mail\SmtpException) from Message::build() or Message::generateMessage() and try sending another message (with or without such exception) on the same sender.
The text was updated successfully, but these errors were encountered:
Description
Before the
Message::generateMessage()
method gets called, there is already some communication with the SMTP server. If the method for some reason throws an exception other thanNette\Mail\SmtpException
, sending the message aborts but the connection is kept open. If you send another message using the same sender, the SMTP server will probably return something like503 sender already given
because from its point of view you are still sending the first faulty message.How can this happen: Using vanilla
Nette\Mail\Message
it probably can't. However because of how the Message builds itself when being sent and because the$parts
property is private, it is impossible to build a wrapper/proxy/decorator/something that would encapsulate an existing message and encrypt/sign it for example. The only feasible way I've found is a to subclass theMessage
class and handle the signature/encryption part inside thebuild()
method. And this can obviously fail. And if it throws something else thanNette\Mail\SmtpException
GO TO previous paragraph.The fix is simple - only change the order of things inside
SmtpSender::send()
. PR #43 present.Steps To Reproduce
Throw an exception (any other than
Nette\Mail\SmtpException
) fromMessage::build()
orMessage::generateMessage()
and try sending another message (with or without such exception) on the same sender.The text was updated successfully, but these errors were encountered: