Email notification with attachment

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
rdlmantisbt
Posts: 3
Joined: 16 Aug 2021, 04:55

Email notification with attachment

Post by rdlmantisbt »

Hi, I would like to know how can I add a hyperlink to the attachment sent via email.
What I would like to achieve is, if an issue with attachment is submitted, the email notification should have a hyperlink which the users can download via email. In the example below, I want 'test attachment.png' to be a hyperlink.

Thanks!
Attachments
email attachment.png
email attachment.png (8.95 KiB) Viewed 10456 times
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Email notification with attachment

Post by cas »

This is not available out of the box. You would need to customize the email message ( the required link is easy enough to pull together). It does require users to have access to mantis and enough rights :mrgreen:
rdlmantisbt
Posts: 3
Joined: 16 Aug 2021, 04:55

Re: Email notification with attachment

Post by rdlmantisbt »

Thanks, cas! How do I do that? Which are the files that I should customize?

I looked at email_api.php and file_download.php looking for <a> tag to modify :D
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Email notification with attachment

Post by cas »

you were on the right track, it is email_api.php.
Find function email_bugnote_add , there you see that the attachments are added to the overview.
Rather than storing the name, you should store an url.
In core/print_api.php you can find function print_bug_attachment_header which will generate a download link.
So now you have some pieces of the puzzle, have fun :mrgreen:
rdlmantisbt
Posts: 3
Joined: 16 Aug 2021, 04:55

Re: Email notification with attachment

Post by rdlmantisbt »

Thank you very much! :D
Post Reply