Debug disabled outgoing mail

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 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,


1 answer

1 accepted

1 vote

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.

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!

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

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 Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

494 views 6 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot