Hello @AlL,
I'd like to know - if someone knows... - if there is a way non-jira users (without a jira account) to receive emails from jira.
To be more specific we have connected 2 jira instances (let's say A & B) and sync 2 projects using Backbone for Jira plugin.
I know that we cannot mention users of Jira A in Jira B and vice versa directly in our comments,.
I'd like to find some mechanism for example to parse synced comments, look for names, and if they match, notify users via email they were mentioned.
I'd like to ask if someone have tried something like that before or has any ideas how to do it. Since we use ScriptRunner I thought that it could help.
Hi @Iro Karavasili,
I'm Matthias (from the Backbone Issue Sync team). 😏
Since you've mentioned that you use Scriptrunner already, the easiest option would probably be to use a ScriptListener on an event like "Issue Commented" to trigger your script.
Inside your script, you can get inspired by this snippet from the Adaptavist library to send a custom email. I'll also include it here for better findability:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.mail.Email
import com.atlassian.jira.mail.settings.MailSettings
import com.atlassian.mail.MailException
import com.atlassian.mail.server.SMTPMailServer
import com.atlassian.plugin.util.ContextClassLoaderSwitchingUtil
import org.apache.log4j.Level
import org.apache.log4j.Logger
String sendEmail(String emailAddr, String subject, String body) {
def logger = Logger.getLogger(getClass())
logger.setLevel(Level.DEBUG)
// Stop emails being sent if the outgoing mail server gets disabled (useful if you start a script sending emails and need to stop it)
def mailSettings = ComponentAccessor.getComponent(MailSettings)
if (mailSettings?.send()?.disabled) {
return 'Your outgoing mail server has been disabled'
}
def mailServer = ComponentAccessor.mailServerManager.defaultSMTPMailServer
if (!mailServer) {
logger.debug('Your mail server Object is Null, make sure to set the SMTP Mail Server Settings Correctly on your Server')
return 'Failed to Send Mail. No SMTP Mail Server Defined'
}
def email = new Email(emailAddr)
email.setMimeType('text/html')
email.setSubject(subject)
email.setBody(body)
try {
// This is needed to avoid the exception about IMAPProvider
ContextClassLoaderSwitchingUtil.runInContext(SMTPMailServer.classLoader) {
mailServer.send(email)
}
logger.debug('Mail sent')
'Success'
} catch (MailException e) {
logger.debug("Send mail failed with error: ${e.message}")
'Failed to Send Mail, Check Logs for error'
}
}
sendEmail('user@email.com', '<Your subject here>', '<Your body here>')
Inside that script, you could also add your own mapping how you map certain strings within the comment to the actual mail address.
I hope that gets you started.
Cheers,
Matthias.
@Iro Karavasili you can also use 3rd pary App from the Marketplace to send out email to non-Jira users.
HTH,
KGM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Iro Karavasili One way i can think of is to create a generic user(dummy user) in Jira and this user will have a distributive mail assigned to it, that way you can assign users without account to Jira to this distributive mail, then when mail is sent to this generic user then then they will receive email from JIRA.
Kind regards,
Moses
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.