The following section of the documentation refers to sending an email when a new user or version is created, but the example only shows code for a new user. I'm been attempting to modify for a new Version, but obviously am missing something. Can someone update it for use with a new Version?
-------
Sending mail from a non-issue event
The built-in script supports only issue-related events, and also "watcher added/removed" events.
If you want to send mail from an event not related to an issue, such as when a new Version or user is created, you can use a Custom Listener configure to handle the appropriate event, and a script such as this:
<span>import</span><span> com.atlassian.crowd.event.user.UserCreatedEvent<br></span><span>import</span><span> com.atlassian.jira.component.ComponentAccessor<br></span><span>import</span><span> com.atlassian.mail.Email<br></span><span>import</span><span> com.atlassian.mail.queue.SingleMailQueueItem
</span><span>def</span> event = event <span>as</span> UserCreatedEvent
<span>def</span> email = <span>new</span> Email(<span>"someuser@example.com"</span>)
email.setSubject(<span>"User created"</span>)
email.setBody(<span>"User: ${event.user.displayName} created..."</span>)
<span>// email.setMimeType("text/html") // for messages with an html body</span>
SingleMailQueueItem item = <span>new</span> SingleMailQueueItem(email)
ComponentAccessor.getMailQueue().addItem(item)