Debug disabled outgoing mail

Florian Fahrenberger May 23, 2016

Hi everybody!

It seems, if the outgoing mail in a JIRA instance is disabled, JIRA will write no logging output for the outgoing mail. Is there any way I can achieve this?

My scenario is this: I have a development instance of JIRA running and am doing a weekly synchronization with our main instance, for testing purposes. Obviously, the outgoing email is disabled (on startup, via setenv.sh) for this development instance, otherwise people would receive emails from it, e.g. for their subscribed filters that are transferred in the synchronization.

Now, I want to do some testing on notifications on the development instance. I thought that just enabling the debugging on outgoing mail ("Logging and Profiling" or via "-Dmail.debug=true" on startup) would log the outgoing mail, even if they are not sent. This would be ideal to check what notifications are sent to whom. Apparently, this is not the case. I can see the notification turning up and disappearing in JIRA's mail queue, but no log is written for it.

So, here are my two questions:

  1. It this on purpose? Or am I doing something wrong? Is the outgoing mail log really only written on connection to the SMTP server, and not on emptying the mail queue?
  2. Does anybody know a good way to test notifications without actually sending out emails to JIRA users?

Any help is appreciated, thanks in advance,

Florian

1 answer

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 23, 2016

No, the "mail disabled" flag kills off the mail well before sending it.  You can't log what you aren't doing.

The usual trick we use is to set up the test system with the email disabled, then install a local mail server (simple postfix will do it), configure that not to forward any mail at all, just quietly bin it all, point the test system at it and re-enable the mail.

Florian Fahrenberger May 23, 2016

Wow, thanks Nic! This was very fast, understandable and helpful!

If there was no such option within JIRA, I would have planned on wrecking the SMTP-settings in the test instance and then just logging the errors, but this is way more elegant.

I am guessing I will have to patch the database before startup, after synchronization from the main instance, to replace the SMTP server settings, right? We are doing this anyways to replace all license keys with the development licenses, so this is no significant overhead. smile

Cheers and greetings from Germany!

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 23, 2016

I've always done it by hand, so I don't know where to look in the database.   But yes, you should be able to replace mailserver:port with localhost:port

One additional advantage is you can also do additonal logging on the mail side without affecting production, you're not restricted to JIRA's logs

Florian Fahrenberger May 23, 2016

Very true.

In case anybody stumbles across this in the future: Replacing the license keys was a bit of a hassle, but the mail server info is easy: It is just stored in the obvious database table "dbo.mailserver", which contains one line with all the info entered in the JIRA mask. smile So this would be something like:

UPDATE dbo.mailserver
	SET SERVERNAME = "localhost"
	WHERE NAME = "YourServerName"

You could obviously also update other fields like the mailusername and mailpassword if needed, or even the port or protocol...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events