User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:setting_up_mail_queuing

This is an old revision of the document!


Setting up Mail Queuing

Introduction

Up to Mantis 1.0.x releases, emails were always sent synchronously. This means that when the user performs an action that triggers the sending of emails, the user had to wait till the emails are actually constructed and sent. The email queueing feature was first implement in Mantis 1.1.0a1 release.

Why email queuing

  • Flaky Email Servers: Sometimes email servers go down, this used to cause an error message to be prompted to the user and the notification to be lost. With email queueing the messages remain in the queue until they are sent successfully.
  • Bad configuration: If the administrator mis-configures the email settings, the user will get errors when emails are triggered and email notifications will be lost.
  • Performance: Typically there are several Mantis users who are notified for every change. An email is sent per user for the following reasons:
    • Different users may have different access levels and hence see different portions of the data.
    • Different users may have different language preference and hence need to get the emails in their preferred language.
    • Email addresses of users must not be disclosed (this can be achieved through bcc, but if emails are only sent to bcc, sometimes anti-spam don't like it).

Requirements

The requirements to this feature were:

  • Improve performance by queuing emails and send them at a later time.
  • Provide a script can be executed from a cronjob to send the queued emails.
  • If email notifications fail, they should remain in the queue and must not be lost.
  • Emails targetted to invalid addresses must not be kept in the queue. A message is considered to be sent successfully as soon as it is delivered to the email server configured in Mantis, if the email server failed to send the message, it will send the NDR back to the email address configured in 'return_path_email' configuration item.
  • By default, the old behaviour for handling emails should be kept. Hence, users must configure queuing, otherwise all messages will be sent synchronously.

Configuring Queuing

  • Set 'email_send_using_cronjob' configuration item to ON.

Sending the Emails

Now that the emails are queued, we need to run the 'mantis/core/send_emails.php' regulary to send the emails. It is recommended to run this script every 1 to 5 minutes. In the example below, we will demonstrate how to run it every minute.

Following is the command line we need to execute:

php /path/to/mantis/core/send_emails.php

Following are the settings that determine how often it the script should run. In this case it's every minute:

Minute = *, Hour = *, Day = *, Month = *, Weekday = *

For hosted environments offering cPanel, the above information will be set after clicking “Cron jobs”, “Advanced (Unix Style)”. You will typically want to also provide your email as the address to which the cronjob output should be sent. This will help you to make sure that the script is running successfully. Once this is established, you should remove your email to avoid getting an email every minute.

Questions

Please add any comments or questions in this sections. Feel free to apply corrections or additions to the main body of the text.

  • How does this work in Windows? Is the Windows Task Scheduler a valid alternative to cronjob?
mantisbt/setting_up_mail_queuing.1168358817.txt.gz · Last modified: 2008/10/29 04:31 (external edit)

CC Attribution-Noncommercial-Share Alike 4.0 International Driven by DokuWiki