Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Delay (sleep time) when sending email

Quote Reply
Delay (sleep time) when sending email
Hi,

I've problem when sending bulk mail (few 1000).

My service provider only allows sending 1000 mails per 15 minutes. So, when I'm sending few 1000 mails at once, after 1000 sending stops with SMTP error.

So, what would be great is option to put some delay time (sleep time) for about one second or just milisecond after sending 100 emails or so.

This will make server think that email stop sending so after second (or milisecond) of sleep time server will think that email started to send from beginning.

Is there possibility to put something like this in option when sending bulk mail (newsletter, all users etc).?

Thanks.

Regards.

P.S. Sorry for my English

UnReal Network
Quote Reply
Re: [deadroot] Delay (sleep time) when sending email In reply to
Since it's a fairly uncommon thing, I don't see us adding such a feature to the code. However, it should be fairly simple for you to add that in yourself if you have some knowledge of Perl. The code you'd want to look at would be in GT::Mail::BulkMail.

Adrian
Quote Reply
Re: [brewt] Delay (sleep time) when sending email In reply to
Problem is that I don't know Perl at all so any help would be really appreciated.

Regards.

UnReal Network
Quote Reply
Re: [deadroot] Delay (sleep time) when sending email In reply to
If you edit admin/GT/Mail/BulkMail.pm, around line 597, you'll see:
Code:
for (@_) {
ref eq 'GLOB' and $self->_send_globref($_), next;
ref eq 'HASH' and $self->_send_hashref($_), next;
ref eq 'ARRAY' and $self->_send_arrayref($_), next;
ref eq 'CODE' and $self->_send_coderef($_), next;
$self->_cause_error("Invalid argument to ".ref($self)."->send()");
}
Just add in your sleep:
Code:
for (@_) {
ref eq 'GLOB' and $self->_send_globref($_), next;
ref eq 'HASH' and $self->_send_hashref($_), next;
ref eq 'ARRAY' and $self->_send_arrayref($_), next;
ref eq 'CODE' and $self->_send_coderef($_), next;
$self->_cause_error("Invalid argument to ".ref($self)."->send()");
sleep 1;
}
1000 messages per 15 minutes is about 1.11 e-mails per second, so a 1 second pause should be enough. If not, bump it to 2 seconds.

Adrian
Quote Reply
Re: [brewt] Delay (sleep time) when sending email In reply to
Ok. Thanks a lot. I'll check is that working and will get back to you.

Regards.

UnReal Network
Quote Reply
Re: [brewt] Delay (sleep time) when sending email In reply to
Well, I guess it's not working. After sending 1000 I got this message (as before).
Code:
A fatal error has occured:From address (`feedback@domain.com') rejected by server. at GT::Mail::BulkMail::_smtp_send line 841, chunk 5011.
Please enable debugging in setup for more details.

UnReal Network
Quote Reply
Re: [deadroot] Delay (sleep time) when sending email In reply to
As far as I know we do not have any email restrictions, but we are running into the same problems as above:
Code:
fatal error has occured:

From address (`admin@domain.com') rejected by server. at GT::Mail::BulkMail::_smtp_send line 843, chunk 5011.

Please enable debugging in setup for more details.
This problem only started when our list exceeded 1000 recipients.
Quote Reply
Re: [aus_dave] Delay (sleep time) when sending email In reply to
You should contact your ISP about it to see what you can do about it.

Adrian