public class

MailListener

extends AbstractIssueEventListener
implements IssueEventListener UserEventListener
java.lang.Object
   ↳ com.atlassian.jira.event.issue.AbstractIssueEventListener
     ↳ com.atlassian.jira.event.listeners.mail.MailListener
Known Direct Subclasses

Class Overview

A listener for emailing notifications.

At the moment when this listener is activated it will email the reporter, assignee and any watchers.

The content of the emails is governed by Velocity templates (in /templates) and the emails are sent out by the MailSender.

Parameters: email.from - who the emails should be sent from email.server - the SMTP server to send email through email.session - the JNDI location of a MailSession to use when sending email subject.prefix - (optional) any prefix for the subject, like "[FooBar]" -> Subject: [FooBar] BazBat

Summary

Public Constructors
MailListener(UserManager userManager, IssueEventBundleMailHandler issueEventBundleMailHandler, MailQueue mailQueue, IssueEventBundleFactory issueEventBundleFactory)
Public Methods
String[] getAcceptedParams()
Returns the parameters used by this listener.
String getDescription()
Returns a textual description of the listener.
@EventListener void handleIssueEventBundle(IssueEventBundle bundle)
void init(Map params)
boolean isInternal()
Indicates whether this listener is internal, meaning it cannot be removed by an administrator.
boolean isUnique()
Indicates whether JIRA should only create one instance of this listener.
void userCannotChangePassword(UserEvent event)
Fired when a user tries to change their password, and the password cannot be updated
void userCreated(UserEvent event)
Fired when a user is created automatically
void userForgotPassword(UserEvent event)
Fired when a user indicates they have forgotten their password
void userForgotUsername(UserEvent event)
Fired when a user indicates they have forgotten their username
void userSignup(UserEvent event)
Fired when a user signs up manually
Protected Methods
void handleDefaultIssueEvent(IssueEvent event)
If you need to treat all the issue events equally, override this method and add logic to handle events.
void sendUserMail(UserEvent event, String subject, String subjectKey, String template)
[Expand]
Inherited Methods
From class com.atlassian.jira.event.issue.AbstractIssueEventListener
From class java.lang.Object
From interface com.atlassian.jira.event.JiraListener
From interface com.atlassian.jira.event.issue.IssueEventListener
From interface com.atlassian.jira.event.user.UserEventListener

Public Constructors

public MailListener (UserManager userManager, IssueEventBundleMailHandler issueEventBundleMailHandler, MailQueue mailQueue, IssueEventBundleFactory issueEventBundleFactory)

Public Methods

public String[] getAcceptedParams ()

Returns the parameters used by this listener.

Returns
  • a non-null array (can be empty)

public String getDescription ()

Returns a textual description of the listener. You can include HTML if required, but do not use tables or DHTML, as the description may be displayed inside tables or frames.

A good description will describe what this listener does and explain the parameters required for configuring it.

Returns
  • a description of the listener, or null if no description is appropriate

@EventListener public void handleIssueEventBundle (IssueEventBundle bundle)

public void init (Map params)

public boolean isInternal ()

Indicates whether this listener is internal, meaning it cannot be removed by an administrator.

Returns
  • true if this is an Atlassian listener, otherwise false

public boolean isUnique ()

Indicates whether JIRA should only create one instance of this listener. For example, having multiple mail listeners would be fine if you wanted multiple mails sent out. For other listeners, such as cache listeners, it makes no sense to have multiple instances.

Returns
  • whether this listener should be a singleton

public void userCannotChangePassword (UserEvent event)

Fired when a user tries to change their password, and the password cannot be updated

Parameters
event the event in play

public void userCreated (UserEvent event)

Fired when a user is created automatically

Parameters
event the event in play

public void userForgotPassword (UserEvent event)

Fired when a user indicates they have forgotten their password

Parameters
event the event in play

public void userForgotUsername (UserEvent event)

Fired when a user indicates they have forgotten their username

Parameters
event the event in play

public void userSignup (UserEvent event)

Fired when a user signs up manually

Parameters
event the event in play

Protected Methods

protected void handleDefaultIssueEvent (IssueEvent event)

If you need to treat all the issue events equally, override this method and add logic to handle events. All legacy event handler methods (unless overridden) in this class call this method.

Parameters
event The received event

protected void sendUserMail (UserEvent event, String subject, String subjectKey, String template)