zopefoundation / zope.sendmail

Zope sendmail support.
Other
3 stars 6 forks source link

Optimize mass mailing by adding an option to set a waiting time between each mail sent #55

Closed gbastien closed 5 months ago

gbastien commented 5 months ago

FEATURE REQUEST Hi @icemac @dataflake does it makes sense to add an option to define a waiting time to avoid SMTP to consider mass mailing as spam? I know there are other solutions, but sometimes, I think that just setting a 3 or 5 seconds waiting time between each mail sent could be useful. Or are there any other simple solution? Thank you for your advice, Gauthier

d-maurer commented 5 months ago

Gauthier Bastien wrote at 2024-4-23 06:56 -0700:

does it makes sense to add an option to define a waiting time to avoid SMTP to consider mass mailing as spam?

With mass mailings, you either have a single message sent to a large number of addresses or a large number of messages.

In the first case, you will need to split the delivery into several deliveries. This means, you need a specialized mailer (which does the splitting).

In the second case, you likely want a specialized mail queue processor which waits between successive send operations.

For both cases, I succest to look at zope.sendmail.queue to learn how to implement your own mail queue processor with your own mailer.

gbastien commented 5 months ago

Hi @d-maurer

thank you for your response.

We could write our own mail queue processor indeed, but I think this could be part of the default QueueProcessorThread as an extra parameter "send_interval" in seconds, 0 by default so would keep current behavior and would sleep given number of seconds between each mail sent.

The question is more, do we propose a PR with this change, that would keep current behavior by default, or should we do it in a separated package. I think this is something that could be useful to other users to avoid spam problems or setting up other complex solutions...

Gauthier

d-maurer commented 5 months ago

Gauthier Bastien wrote at 2024-4-24 02:18 -0700:

Hi @d-maurer ... We could write our own mail queue processor indeed, but I think this could be part of the default QueueProcessorThread as an extra parameter "send_interval" in seconds, 0 by default so would keep current behavior and would sleep given number of seconds between each mail sent.

Personally, I do not want to support mass mailings. Therefore, I am against making such things easy.

The parameter you want only helps when you send lots of individual messages; if you send the same message to lots of people, the mailer would need to split the address list and generate internal messages and apply a sleep parameter in between.

... The question is more, do we propose a PR with this change, that would keep current behavior by default, or should we do it in a separated package. I think this is something that could be useful to other users to avoid spam problems or setting up other complex solutions...

I would much prefer not to have this in a package associated with zopefoundation.

dataflake commented 5 months ago

Don't forget that this kind of throttled mail delivery doesn't have to be implemented in zope.sendmail itself. You can also configure zope.sendmail to deliver to the local mailer and configure that local mailer to do the throttling.

gbastien commented 5 months ago

@d-maurer

OK I understand your point of view :-)

We will implement this in our package and see if it can helps because sending emails is still used very often and is a nightmare to not be considered as spam.

Have a nice day, Gauthier

icemac commented 5 months ago

I consider this issue as solved, so closing it now.