Jira: Creating Issues and Comments from Email with no subject - jira

I'm looking for a way to control the way the "Creating Issues and Comments from Email" works. At the moment since we are using the built in system any received email that has no subject cause the service to fail with the message "Issue must have a summary. The mail message has an empty or no subject.". Every time this happens we have to process the email manually.
Do you know of any way around this?
EDIT
The emails are being sent by customers, so I can't enforce all of them to send a subject.
The problem is that the mail creation service won't process the email once it has no subject.. so setting default value won't help. The only way i can think of is rewriting the mail service. Does anyone knows how could i do that? i I found the original source code here, but not sure how to build and deploy it.
Anyway can think of any other way?
Thanks!!

I assume that you just added some service to Jira in admin interface which automatically serializes emails.
If you want to fully customize the default behaviour, you can write your own simple jira plugin.
See the Atlassian pages:
https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project
https://developer.atlassian.com/display/JIRADEV/Component+Plugin+Module
Your atlassian-plugin.xml should include something like:
<component key="message-handler-factory" class="com.atlassian.jira.plugins.mail.internal.DefaultMessageHandlerFactory" public="true">
<interface>com.atlassian.jira.service.util.handler.MessageHandlerFactory</interface>
</component>
You can for example extend the CreateOrCommentHandler class.

Related

Send email to Umbraco 4

I helping a client with a Umbraco 4 solution. When they send a email message to some special email addresses Umbraco picks them up and creates news post with the email subject, message and picture. One of the emails are failing. Do any of you now where i need to look?
That's not very specific, this could have been achieved in one of many ways. Umbraco doesn't have anything like that built in, so my guess would be that there's a scheduled task that checks the email account somewhere and creates the posts.
To check if the scheduled task is being run by Umbraco, look in /config/umbracoSettings.config and look for the <scheduledTasks> element. If there's something listed there, that might give you a clue of where to look.
If there's nothing there, the task is probably being run from elsewhere (windows task scheduler, or event hooks on the mail server maybe), so you'd have to look there.
You could also check the /config/BaseRestExtensions.config file and see if there are any endpoints listed there that might give you a clue as to where the code that does the page creation might live.

How to change the issue Type of an issue in JIRA via email?

I am working on an MVC application that is currently sending an email to JIRA and it is creating an issue. I am currently configuring all of the required fields and currently the issue being created has the issue Type set to bug as a default and also I think the priority set to minor.
I need to be able to change these two fields from the default as this application is used for clients that need to choose the correct issue and priority.
Currently I am using the TO, FROM, CC as the assignees, client and reporter. The summary and description are used by the subject and body respectively. This is why I don't know if it is actually possible to change these.
Can this actually be done, for example in the body "issueType" = "BUG", or "issueType":"Task"?
The application has the IssueType and Priority as dropdown list so could I append this to the body or maybe the subject of the email and send it. All code is working just need to know how/if I can set these two properties.
Update
I saw an example of this being used but I am unsure of how to implement this into an email form or if this can be done. And I am also using smtp gmail to send the information in my MVC application.
handler.params: project=XXOODD, issuetype=2
https://answers.atlassian.com/questions/39041/jira-creating-issues-and-comments-from-email
By default this cannot be done, but by using a couple of add-ons you can successfully get it to work:
https://marketplace.atlassian.com/plugins/com.metainf.jira.plugin.emailissue
https://marketplace.atlassian.com/plugins/com.javahollic.jira.jemh-ui

JIRA 4.1.1 disable user notification

We are running JIRA 4.1.1 and had an employee who moved elsewhere in the company. We still need his issues in JIRA so we can't completely removed him. Is there anyway to make it so he won't still receive emails/notifications?
I need a solution other than changing the email to an unused or invalid email address, because this will start eating up log space in JIRA
Thanks.
If he moved to another role, his tasks and responsibilities should have been taken over by someone else.
Make a bulk edit and assign that new user to the given issues.
With bulk edit, you can change reporter also.

Email threading

I'm working at a helpdesk application where i have a standalone script that queries a mail server and parses the mail it finds there.
I'm facing the following issue: How do i figure it out in a reliable way what mail is in reply to what mail?
I could add something in the subject like "[ticket:21312]" and look for that but what if the user changes the subject? Is there another way? Can i do it by setting a custom mail header and look for that or the header will not be preserved between mail servers on reply back from user?
What about when i send a message from my application to a non existing user or a user that has quota full and his server replies back with the usual standard message "the mail daemon at .... could not ...." then the subject will also be modified and i can't place the message correctly as a reply to an existing mail.
How does gmail do it? There the messages are sorted perfectly in almost all of the cases.
in helpdesk email piping there are 3 basic methods:
a) include the id in the subject somewhere (works fine in practice)
b) have the id in the body somewhere
c) use an auto-generated email alias with the id, like "case-76236781980893#helpdesk.mycompany.com". that can easily be handled by something like procmail or a script to pick out the id.
gmail might use a combination of the subject, In-Reply-To header (may not be defined) (References and Original-Message-ID headers possibly as well), and various heuristics, which work very well, but of course not necessarily bulletproof, and slightly more involved to implement. something like nestscape's original threading algorithm perhaps. though some have reported that gmail doesn't use the In-Reply-To header and relies mostly on the subject (as in this post).
As you say custom headers might get lost and the subject might change. Use both. If one exists then you can identify the thread. I don't know of any better way to solve this.
If your message was sent with a Message-ID-Header any standards-conform mailer should add a In-Reply-To-Header referencing your Id. Additionally Referencesshould contain a list of all previous mails in this thread.
This works with most mail clients, to be safe for the bad clients you have to use the subject, the easy way is by adding the "[issue:123]" thing, a secondary fallback is to recognize the subject (after cutting of the "Re:" part in all the variations) for this it could help that you know most of your legitimate senders ...

Best practices on processing email sent to app specific address in rails?

We would like to implement a feature by which users could send an email to an application specific address and we will parse the message and take certain actions on it, similar to 37signals's backpack (and probably some of their other apps).
If anyone has done something similar, could you fill me in on how you did so? I'm unsure on how to, at a high-level, 'import' the email into the app so that I could process it.
Thank you.
I have recently implemented that exact functionality in rails. I would advice you to look at the 'Receive E-mail Reliably via POP or IMAP' in the the Advanced Rails Recipes book.
I've personally found that the best source for getting this up and running and it explains how to do far better than I can. Good luck which ever way you choose to do it :)
Here's how I fetch from a POP server:
require 'net/pop'
pop = Net::POP3.new('mail.yourdomain.com')
pop.start(account, password)
pop.each_mail do |m|
email = TMail::Mail.parse(m.pop)
email.base64_decode
OttoMailer.process_email_in(email, m.unique_id)
m.delete
end
pop.finish
Why not run a Ruby SMTP mailserver, which will receive the mails via port 25, and then you can parse/interpret etc. as you wish ?
(I say Ruby since that's how you've tagged your question)
An alternative solution is to run procmail (or similar), pattern match on the subject, and then invoke scripts (configured in the .procmailrc file). However that may not scale so well for large volumes of mail.
ActionMailer can receive e-mails as well as send them! I don't remember how this is done but if you look at the documentation you can see it there. But from memory the e-mail gets piped through procmail into a script in the script directory.
There seems to be a book on the subject as well.
Good luck! :)

Resources