Add support for retrieving last server reply from sendMail() #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The current implementation only verifies that the last reply is
250
. However, it does not provide access to the actual reply message. Services like AWS SES include essential data in the last reply, such as250 ok <messageId>
, which is critical for tracking emails.Solution
This PR modifies the existing
sendMail()
procedure to return aFuture[string]
instead of discarding the server's response. The new version ofsendMail()
has been renamed tosendMailGetReply()
to reflect its behavior. A newsendMail()
wrapper was introduced, which callssendMailGetReply()
but discards the result, ensuring full backward compatibility.Additionally, the final usage of the
checkReply
procedure withinsendMailGetReply()
has been replaced with inline code, ascheckReply
does not return any value.Notes
sendMail()
: Ideally, the originalsendMail()
would be marked as.discardable.
to allow users to optionally retrieve the reply. However, the asynchronousmultisync
blocks this approach.checkReply()
: It would also be preferable to makecheckReply
.discardable.
and directly use its return value for simplicity. However that requires (1) first.Example