JIRA Service Desk Attachments

John Carr October 10, 2017

Morning All

Hope someone can help.

We have started to use JSD but not via the portal, customers send in requests via email. When i put an attachment on a ticket and the customer gets the email notification back with the attachment, the link for the attachment seems to indicate they need access to the portal which currently they dont have. So they cant actually view/download the attachment.

Any ideas, thanks.

J

7 answers

2 accepted

6 votes
Answer accepted
Deleted user October 10, 2017

Hi John,

JSD email notifications to customers that contain attachments require the customer to click a link and login to view the attachment, currently there is no built in way to attach the issue attachment to the email itself. A suggestion is already open with Atlassian to implement this: JSDSERVER-3371

Currently the only way to attach the file to the actual email is via a third-party mail handler plugin such as JEMH (I work for the vendor) which is capable of gathering all the relevant issue attachments and attaching them directly to email notifications.

Kind Regards,

Reece

John Carr October 10, 2017

thanks for the reply

Like benvindo.marial likes this
Giovanni Salvagno May 29, 2018

hi, it seems this workaround does not work

does it work for you ?   

Giovanni Salvagno May 29, 2018

sorry I had to replay to the next message

Deleted user May 29, 2018

JEMH is a replacement for the built in Jira Service Desk notifications, simply installing JEMH will not be enough to get attachments attaching directly to emails. You will need to configure JEMH so that all of your JSD notifications are sent via JEMH.

A quick start guide for JEMH can be found here: JEMH Quickstart Guide

Support for the product is available via: support@thepluginpeople.com

0 votes
Answer accepted
Igor Repinetski August 30, 2019

Hi!

We faced with the same problem and found no good solution better than the dirty trick, described below. Do not do it if you are not sure! Also the solution assumes there is no sensitive data in the attachments, as it bypasses the access control completely.

Our Jira Service Desk runs on Ubuntu+Apache2 and stores the attachments in /var/atlassian/application-data/jira/data/attachments/HELPD (HELPD is service desk application name)

1. Add www-data user to jira group: 

sudo usermod -a -G jira www-data

2. Create a symbolic link to the attachments dir from somewhere else: 

ln -s /var/atlassian/application-data/jira/data/attachments/HELPD /var/www/helpdesk_attachments/

3. Some sub-directories in /var/atlassian/application-data/jira/data/attachments/HELPD path are accessible for jira user only. Check all subdirs and change their permissions (if needed) with

chgrp jira /var/atlassian/application-data/jira/

chmod 750 /var/atlassian/application-data/jira/

 

Now you should be able to list attachments file structure with a command like

ls -R /var/www/helpdesk_attachments/*

 

4. In apache2 config of your site add the lines (it assumes Jira is configured with /jira URL prefix):

ScriptAlias "/jira/secure/attachment" "/var/www/helpdesk_attachments/index.php"

ProxyPass /jira/secure/attachment !

before 

ProxyPass /jira http://localhost:8040/jira
ProxyPassReverse /jira http://localhost:8040/jira

5. Create PHP script /var/www/helpdesk_attachments/index.php with the content

<?php

$pieces = explode("/", $_SERVER['REQUEST_URI']);
$size = sizeof($pieces);
$files = glob(getcwd() . "/*/*/*/" . $pieces[$size-2]);

$filepath = $files[0];

if(file_exists($filepath)){

$filename = $pieces[$size-1];
$prefix = $pieces[$size-2] . '_';
$filename = preg_replace("/^$prefix/", '', $filename);
$mime = getMime($filename);

  header('Content-Type: ' . $mime);
    header('Content-Disposition: attachment; filename=' . $filename);

    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');

    header('Content-Length: ' . filesize($filepath));

    ob_clean();
    flush();
    readfile($filepath);
    exit;
}

function getMime( $filename ) {
$types = array(
    'ai'      => 'application/postscript',
    'asc'     => 'text/plain',
    'avi'     => 'video/x-msvideo',
    'bin'     => 'application/octet-stream',
    'bmp'     => 'image/bmp',
    'class'   => 'application/octet-stream',
    'css'     => 'text/css',
    'csv'     => 'text/csv',
    'doc'     => 'application/msword',
    'dtd'     => 'application/xml-dtd',
    'eps'     => 'application/postscript',
    'gif'     => 'image/gif',
    'htm'     => 'text/html',
    'html'    => 'text/html',
    'ico'     => 'image/x-icon',
    'jpeg'    => 'image/jpeg',
    'jpg'     => 'image/jpeg',
    'js'      => 'application/x-javascript',
    'json'    => 'application/json',
    'mathml'  => 'application/mathml+xml',
    'mov'     => 'video/quicktime',
    'mpeg'    => 'video/mpeg',
    'mpg'     => 'video/mpeg',
    'pdf'     => 'application/pdf',
    'png'     => 'image/png',
    'ppt'     => 'application/vnd.ms-powerpoint',
    'ps'      => 'application/postscript',
    'qt'      => 'video/quicktime',
    'rtf'     => 'text/rtf',
    'svg'     => 'image/svg+xml',
    'svgz'    => 'image/svg+xml',
    'swf'     => 'application/x-shockwave-flash',
    'tar'     => 'application/x-tar',
    'tif'     => 'image/tiff',
    'tiff'    => 'image/tiff',
    'tsv'     => 'text/tab-separated-values',
    'txt'     => 'text/plain',
    'xhtml'   => 'application/xhtml+xml',
    'xls'     => 'application/vnd.ms-excel',
    'xml'     => 'application/xml',
    'xsl'     => 'application/xml',
    'xslt'    => 'application/xslt+xml',
    'zip'     => 'application/zip',
    'eml'     => 'message/rfc822'
);

$path_info = pathinfo($filename );
$ext = strtolower($path_info[extension]);
$mime = $types[$ext];
if ( $mime === null ) {
$mime = "text/plain";
}

return $mime;
}

?>

In the code there is a redundant getMime() implementation. For some reason on our system the standard PHP's mime_content_type() does not work, so it was easier/safer not to troubleshoot the prod system, but to implement a minimalist replacement.

6. Add error handling to the index.php if you find it is needed.

7. restart Apache with sudo service apache2 restart

Jason February 7, 2020

Ingenious, Nice man!

Joanna Neuberg August 18, 2020

@Igor Repinetski Is there any way this could work for Cloud? Thank you! 

Like David Valle likes this
Pushpkant Garg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 3, 2021

On Cloud it is available by default. Attachments will be downloaded automatically.

1 vote
Jose León Serna July 9, 2018

Apart from the other replies, you can also use Mail Attachments for JIRA Service Desk that has been released exclusively to address this problem:

https://marketplace.atlassian.com/apps/1219283/mail-attachments-for-jira-service-desk?hosting=server&tab=overview

Nick Rusman October 9, 2018

@Jose León Serna this addon still displays a link to the portal (in the e-mail send to the customer). Rendering it useless.

Kasper Rytter December 19, 2018

Really? Then I am unsure it fits my needs anyway. On the atlassian marketplace it says: "All attachments are included as an actual e-mail attachment within the e-mail notification so that the attachment can be downloaded directly from the e-mail without having to login to the instance."
But should it be understood in the way that there is a link that allows you to download it, but you will have to press the link to do so? It is not just "in" the e-mail just as if I sent a mail to you with an attachment in?

Like Alexander Drobyshevsky likes this
Deleted user December 20, 2018

I cannot speak for the other app mentioned above but JEMH does attach the attachments to notification emails directly as you describe, you would need to switch to using JEMH for your Service Desk notifications to achieve this.

Like RentalHost likes this
Boris Berenberg - Atlas Authority
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 29, 2020

Mail Attachments for Jira Service Desk includes it directly in the email. We have moved this functionality into [Notification Assistant for Jira|https://marketplace.atlassian.com/apps/1211069/notification-assistant-for-jira-email?hosting=server&tab=overview]

1 vote
WEBCODER LTD (EU) April 13, 2018

Have you tried a cheap "Email this issue" add-on?

0 votes
Meagan December 11, 2019

We're in the same boat (emailing from JSD, but not using the portal), so we had to build a custom file uploader through AWS, build in a new attachment location in our issue screens, and disable the built-in attachment option so our users don't get confused. This is working for outbound emails from JSD - the customer still receives a link, but it's pointed at the AWS location and not our network, so they can access the file(s) without logging in.  

0 votes
Vladimir Horev _Raley_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2019

Hi all,

 

You can add regular files and inline attachments (to comment) to email notification using our add-on Raley Email Notification

Here's an article explaining how to do that

0 votes
volkan ciftci
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 10, 2017

Hi John;

Workaround : Do not use "space" or characters like  (+%&/-) in the attachements/files name.

 

Br

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events