Error 'Mail is disabled' while trying to use my Custom Mail Handler plugin

Andrij December 5, 2017

Hi colleagues. ;)

I'm trying to write Custom Mail Handler for creating/modifying issues according to contents of notifications sent by mail. I want to process contents of mail contents with my own code.

 

I went through atlassian tutorial. Tried to simplify things and added only one component (java class). This Java class implements MessageHandler interface.

I'm testing this plugin on localhost:2990/jira (2990 port).

 

But mail handler doesn't work and return this error in command line:

 [INFO] [talledLocalContainer] 2017-12-05 13:18:39,213 Caesium-1-1 INFO anonymous    CompanyName Support Robot [c.a.mail.incoming.mailfetcherservice] CompanyName Support Robot[10001]: Mail is disabled.

 Mail handler doesn't work and doesn't delete message from mail box.

 

I also tried code from (used all files for plugin): 

git clone https://bitbucket.org/atlassian_tutorial/jira-add-email-handler.git

->Same problem.

my java class (modifyed for security reason):

package com.company.plugin.companynamemailhandler;

import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueInputParameters;
import com.atlassian.jira.service.util.handler.MessageHandler;
import com.atlassian.jira.service.util.handler.MessageHandlerContext;
import com.atlassian.jira.service.util.handler.MessageHandlerErrorCollector;
import com.atlassian.jira.user.ApplicationUser;

import java.util.Map;
import javax.mail.Message;
import javax.mail.MessagingException;

import com.atlassian.jira.user.UserUtils;
import com.atlassian.mail.MailUtils;


public class CompanyNameHandler implements MessageHandler {

//author of issues
private String userName = "admin";

@Override
public void init(Map<String, String> params, MessageHandlerErrorCollector monitor) {
//There is no any code inside this method
}


@Override
public boolean handleMessage(Message message, MessageHandlerContext context) throws MessagingException {

//In this part of program im creating issue and comment based on incoming mail.
//Deleted for security reason.

return true;
}
}

 

Please help me to solve this :) I'm already ill from debugging and don't really know how to bread through this issue.

I'm using jira 7.5.2 and my mail box is on gmail, sending also from gmail.

 

Thank's in advance.

2 answers

2 votes
Robin Svenhard May 30, 2018

Hi Andrij.

I had the same issue as you did, and found the answer. I got maven-jira-plugin to work with fetching mail by adding the element systemPropertyVariables, containing atlassian.mail.fetchdisabled=false, see below. I also added popdisabled since I use a pop3 server.

<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<systemPropertyVariables>
<atlassian.mail.fetchdisabled>false</atlassian.mail.fetchdisabled>
<atlassian.mail.popdisabled>false</atlassian.mail.popdisabled>
</systemPropertyVariables>

<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

<!-- Add package to export here -->
<Export-Package>
my.plugin,
</Export-Package>

<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>

<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>

 

I realize it's been a while since you asked the question, but hopefully this is also helpful to others who find this and have the same problem.

0 votes
Andrij February 9, 2018

Hi. I found workaround that works for me. 

1. When i'd like to test my plugin I run "atlas-mvn package" from command line.

2. Upload my plugin from target folder

(for example "C:\Program Files\Atlassian\Application Data\JIRA\plugins\mail-handler-demo\target")

to my original jira instance and test.

 

I tryed a lot of stuff, but this is the only way for me.  

Marcel Kleinlütke December 20, 2021

I got the same message. We fugured out that some chenged the start arguments. So we did this:
08-Dec-2021 14:27:56.738 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Datlassian.mail.senddisabled=false
08-Dec-2021 14:27:56.738 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Datlassian.mail.fetchdisabled=false


The layer in GUI disappered but the mail handler still says "Mail is disabled" Mails could not be fetched. They remained unread. They are younger that 2 days.
 The connection test are successful. Is it because we use Postfix for outgoing and another for incomming?

Marcel Kleinlütke January 13, 2022

It was the Datlassian.mail.fetchdisabled=false
false did not work so we used # after the restartit worked

Suggest an answer

Log in or Sign up to answer