GoMail is a powerful library for sending emails via multiple providers, including SMTP, Gmail API, Microsoft Graph API, SendGrid, AWS SES, Mailgun, Mandrill, Postmark, and SparkPost. Supporting attachments, plain text, and HTML content, it simplifies email integration for developers with easy setup and robust functionalities.
Is your feature request related to a problem? Please describe.
At present, there is no mechanism to restrict the size of attachments in the EmailMessage struct within the gomail package. This lack of restriction can result in issues when large attachments exceed the size limits set by email providers, leading to email delivery failures. Users currently have no control over the maximum size of attachments, which can cause frustration when emails fail to send without clear reasons.
Describe the solution you'd like
The proposed solution is to introduce a feature that allows setting a maximum size for attachments in EmailMessage instances. This feature would include the following components:
A default maximum attachment size (e.g., 25 MB).
A method to set a custom maximum attachment size.
Logic to exclude attachments that exceed the specified maximum size during the email sending process.
Comprehensive updates to the documentation to describe the new feature and provide instructions on its usage.
Describe alternatives you've considered
An alternative approach would involve users manually checking the size of each attachment before adding it to an EmailMessage. However, this method requires additional effort from users and is less efficient compared to having an integrated solution within the library.
Additional context
Implementing this feature will enhance the usability and reliability of the gomail package by preventing large attachments from causing email delivery failures. It aligns with best practices for email transmission and assists users in avoiding common issues. The implementation will include thorough testing to ensure the feature functions as intended and does not introduce any regressions.
Is your feature request related to a problem? Please describe. At present, there is no mechanism to restrict the size of attachments in the
EmailMessage
struct within thegomail
package. This lack of restriction can result in issues when large attachments exceed the size limits set by email providers, leading to email delivery failures. Users currently have no control over the maximum size of attachments, which can cause frustration when emails fail to send without clear reasons.Describe the solution you'd like The proposed solution is to introduce a feature that allows setting a maximum size for attachments in
EmailMessage
instances. This feature would include the following components:Describe alternatives you've considered An alternative approach would involve users manually checking the size of each attachment before adding it to an
EmailMessage
. However, this method requires additional effort from users and is less efficient compared to having an integrated solution within the library.Additional context Implementing this feature will enhance the usability and reliability of the
gomail
package by preventing large attachments from causing email delivery failures. It aligns with best practices for email transmission and assists users in avoiding common issues. The implementation will include thorough testing to ensure the feature functions as intended and does not introduce any regressions.