web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Send large batch of email from code

(6) ShareShare
ReportReport
Posted on by 3,297
Hi All
What are the considerations option for triggering emails from code where the number of unique email address are around 2000. If there a way to queue and do we increase the rate limit for email account? Looking for best practice and performance considerations
I have the same question (0)
  • Suggested answer
    Mansi Soni Profile Picture
    8,951 Super User 2026 Season 1 on at
    Hello,

    When triggering emails from code to around 2,000 unique addresses in Business Central or any external system, it's essential to queue the emails using a scheduled background process (e.g., Job Queue). This prevents timeouts and improves performance. Bulk sending should be done in batches (e.g., 100–200 at a time) with delays if needed to avoid throttling. For Business Central, if using SMTP or Exchange, Microsoft 365 imposes limits (e.g., 10,000 recipients/day, 30 messages/minute per sender). 

    https://learn.microsoft.com/en-us/dynamics365-release-plan/2022wave2/smb/dynamics365-business-central/easily-comply-email-sending-limits-through-email-throttling

    https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365

    Hope this will help you!

    Regards,
    Mansi Soni
  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,803 Super User 2026 Season 1 on at
    Hello,
     
    To send emails to around 2,000 recipients from Business Central code, it's best to implement a queuing system using a custom email queue table and process emails in batches via a scheduled job queue to avoid timeouts and respect SMTP rate limits.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,801 Super User 2026 Season 1 on at
     

    When sending emails to ~2000 unique recipients from code in Dynamics 365 Business Central (D365BC), it's crucial to follow best practices around performance, rate limits, email queuing, and Microsoft policies. Here's a breakdown of your options, risks, and best practices.

    Key Considerations for Email Sending in D365BC

    1. Email Provider Rate Limits

    • Microsoft 365 (Exchange Online) has send limits:

      • 10,000 recipients per day per mailbox.

      • 30 messages per minute.

      • 500 recipients per message (if using BCC-style).

    • SMTP providers (e.g., SendGrid, Mailgun) have similar or configurable limits.

    Best practice: Don’t send all 2000 at once — break into batches, and optionally queue.

    2. Built-In Email Capabilities in D365BC

    • Email feature (SMTP, Microsoft 365, or third-party) is built into Business Central.

    • Use the EmailMessage and Email codeunits.

      • Email.Send() is synchronous and not ideal for large volumes.

      • Email.SendUsingJobQueue() queues emails for background processing — recommended

    3. Queuing Emails (Recommended)

    To avoid timeouts and performance issues:

    • Use the Job Queue to queue emails asynchronously.

    • Send emails in controlled batches via codeunit and schedule through Job Queue.

    Example Approach:

     
    procedure SendBulkEmails(RecipientList: List of [Text])
    var
        EmailMessage: EmailMessage;
        Email: Codeunit Email;
    begin
        foreach EmailAddress in RecipientList do begin
            EmailMessage.Create('sender@yourcompany.com', EmailAddress, 'Subject', 'Body');
            Email.SendUsingJobQueue(EmailMessage); // This queues the email
        end;
    end;
    
     
    • You could also group recipients into BCC batches (e.g., 50–100 per message) to reduce the total volume


    •  

    4. Use External Email Services (Optional but Scalable)

    For better performance and deliverability:

    • Use Azure Logic Apps, Power Automate, or external SMTP services (like SendGrid or Amazon SES).

    • From AL code, call an external API that pushes email data to the service.

    This allows:

    • Rate control

    • Retry handling

    • Logging

    • Deliverability tracking

    5. Monitoring & Logging

    • Log email status and errors (create a custom log table if needed).

    • Monitor Job Queue entries for failures.

    • Consider adding retry logic in case of send failure.

    Batch Strategy Recommendation (for 2000 recipients)

    Strategy Description Recommendation
    Single Email per User One job queue entry per recipient ✅ Good, scalable with job queue
    Grouped BCC Batch One email to 100 users via BCC ✅ Efficient, but beware of spam filters
    Use External Email API Send via SendGrid/Azure via API ✅ Best for large volumes
    Direct Send in Loop Email.Send() in loop (synchronous) ❌ Avoid for performance/scaling
     

    Email Rate Limits — Can You Increase?

    • Microsoft 365 send limits are not configurable — they're service-enforced.

    • For higher needs:

      • Use a dedicated mailbox just for bulk mail.

      • Use third-party email providers like SendGrid or Mailgun for transactional email via APIs.

    Compliance & Best Practice Reminders

    • Unsubscribe support if it’s a marketing-like email.

    • Avoid spam-like patterns to protect domain reputation.

    • Ensure email templates are efficient (no unnecessary dynamic images or large files).

    Summary: Best Practices for Sending ~2000 Emails from D365BC

    Practice Recommendation
    Use SendUsingJobQueue() ✅ Yes
    Break into batches (e.g., 100) ✅ Yes
    Avoid direct Email.Send() in loops ❌ Avoid
    Monitor & log sending ✅ Yes
    Consider external service for bulk ✅ Especially for scaling
     

     

  • Verified answer
    Jeffrey Bulanadi Profile Picture
    9,112 Super User 2026 Season 1 on at

    Hi Samantha

    When sending emails to around 2,000 unique addresses from code in Business Central, there are several performance and reliability considerations to keep in mind. Here's a breakdown of best practices:

    1. Use the Email Outbox and Queuing Logic

    • Instead of sending emails immediately, insert them into the Email Outbox using the Email Message codeunit
    • This allows Business Central to process them asynchronously, reducing the risk of timeouts or throttling

    2. Respect Rate Limits

    • Microsoft 365 and SMTP connectors have rate limits (e.g., 30 emails per minute for SMTP by default)
    • You can configure email throttling in BC to control the send rate per minute
    • See this guide for setup: 

    3. Batch and Delay Logic

    • Break the 2,000 emails into smaller batches (e.g., 100 per run)
    • Use Job Queues or Scheduled Tasks to process each batch with a delay between runs
    • This avoids overwhelming the email server and keeps the UI responsive

    4. Use AL Code Safely

    Here’s a simplified example of how to queue emails:

     
    EmailMessage.CreateMessage(ToAddress, Subject, Body, false);
    EmailMessage.AddRecipient(ToAddress);
    EmailMessage.Send(false); // false = send via outbox
    
    
    

    5. Monitor and Retry

    • Track failed sends using the Sent Email and Email Outbox pages
    • Implement retry logic for transient failures (e.g., network or rate limit issues)

    Supporting Visual
    Here’s a screenshot showing how to configure the email rate limit in Business Central:


    https://yzhums.com/32813/

    Let me know if you’d like help writing the batching logic or setting up the job queue. We can make this scalable and safe for production use.

    If you find this helpful, feel free to mark this as the suggested or verified answer.

    Cheers
    Jeffrey

    sddefault.jpg
  • Suggested answer
    YUN ZHU Profile Picture
    99,086 Super User 2026 Season 1 on at
    Hi, Try the following settings.
     
    Also, please note that email providers also have restrictions. I'm not sure what email provider you are using, so you can check it out.
     
    Hope this helps.
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,005 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,148 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 557 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans