feat: added Send Time Optimization (STO) param #304
Merged
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.
Purpose: Add Send Time Optimization (STO) functionality. STO is a Mailgun feature that utilizes machine learning to determine the optimal time to deliver a message to a recipient. The goal is to deliver the message right before the recipient typically checks their email, increasing the chances of engagement and improving overall engagement rates, leading to higher conversions and increased ROI.
Implementation Details: Introduce a new method, SetSTOPeriod, to the Message class, which allows setting the o:deliverytime-optimize-period parameter (https://documentation.mailgun.com/en/latest/api-sending.html#sending). The parameter follows the specification: "Toggles Send Time Optimization (STO) on a per-message basis. The string should be set to the number of hours in [0-9]+h format, with a minimum of 24h and a maximum of 72h." The implemented code performs checks to ensure adherence to this specification.