I need to a send a customized email in every 1 hour for a particular filter
If you would like to do to this without writing code, you can do this using our app Notification Assistant for Jira https://marketplace.atlassian.com/apps/1211069/notification-assistant-for-jira-email?hosting=server&tab=overview
If you really need something completely custom, yeah, it's possible but it requires a lot of scriptrunner skills.
You'll need to:
Create a custom job to run every hour
Have your script run the JQL and handle the results
The script will need to construct the email body and dynamically identify recipients if applicable
But here is a sample script to send an email:
import com.atlassian.mail.Email
import com.atlassian.mail.MailException
import com.atlassian.mail.MailFactory
import com.atlassian.mail.queue.SingleMailQueueItem
import com.atlassian.jira.component.ComponentAccessor
def mailServerManager = ComponentAccessor.mailServerManager
def mailServer = mailServerManager.defaultSMTPMailServer
if (mailServer && !MailFactory.settings.sendingDisabled) {
def email = new Email('recipent@domain.com')
email.setFrom(mailServer.defaultFrom)
email.setSubject('your email subject')
email.setMimeType('text/html')
email.setBody('your email body')
try {
def mailItem = new SingleMailQueueItem(email)
ComponentAccessor.mailQueue.addItem(mailItem)
return "Mail sent"
} catch ( MailException e){
log.error e.message
return "Failed to send"
}
} else {
return "Message not sent: no outgoing server or sending is disabled"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.