How throttle email queue

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
8/28/2020 6:21:51 AM
Gravatar
Total Posts 128

How throttle email queue

We're sending emails from a site using the mojoPortal email mechanism mojoPortal.Net.Email, but sometimes hitting limits in the Office 365 email relay. Entries like this in the log

2020-08-27 14:52:32,736 ERROR (null) - (null) - (null) - mojoPortal.Net.Email - error sending email to xxx@xxxx.uk from xxxxx@xxx.uk, will retry 
System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: 4.3.2 STOREDRV.ClientSubmit; sender thread limit exceeded [Hostname=DB6PR0701MB2248.eurprd07.prod.outlook.com]
   at System.Net.Mail.DataStopCommand.CheckResponse(SmtpStatusCode statusCode, String serverResponse)
   at System.Net.Mail.DataStopCommand.Send(SmtpConnection conn)
   at System.Net.ClosableStream.Close()
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at mojoPortal.Net.Email.Send(SmtpSettings smtpSettings, MailMessage message)

We think we're simply exceeding the number of concurrent sends and perhaps also the number of messages per minute that are supported by O365, as per https://docs.microsoft.com/en-us/exchange/troubleshoot/send-emails/smtp-submission-improvements 

I've seen that the mojoPortal Newsletter and Forums both have settings to throttle the email sending.

    <add key="NewsletterMaxToSendPerMinute" value="0" />
    <add key="Forum:NotificationMaxToSendPerMinute" value="0" />

Is there similar for global emailing? Any other suggestions? (Using a different email provider is not a solution available in the immediate situation).

TIA!

9/2/2020 1:00:45 PM
Gravatar
Total Posts 2239

Re: How throttle email queue

Hi Crispin,

We don't have throttling controls outside of the newsletter and the forums. 

The throttling in those features is implemented within them only, not within the email system itself.

The throttling is actually quite simple in the newsletter and can be found in the LetterSendTask.cs code.

Are you sending email through a custom feature? If so, try implementing the same logic that's used in LetterSendTask.cs. If not, what is sending so much email on your site?

Thanks,
Joe

9/2/2020 3:48:25 PM
Gravatar
Total Posts 128

Re: How throttle email queue

Hi Joe, yes this is from custom features which can send a lot of emails, so yes next step is to look to implement throttling ourselves, as you suggest. First we just wanted check there wasn't something built in already.

Thanks for pointing us at https://github.com/i7MEDIA/mojoportal/blob/master/Web/Components/LetterSendTask.cs

 

You must sign in to post in the forums. This thread is closed to new posts.