@NonInjectableComponent public interface

MailAttachmentsManager

com.atlassian.jira.mail.util.MailAttachmentsManager
Known Indirect Subclasses

Summary

Constants
String CID_PREFIX Content-ID for generated attachments.
Public Methods
Iterable<BodyPart> buildAttachmentsBodyParts()
Builds bodyPart for each image (including avatars) added to this manager
int getAttachmentsCount()
Returns the number of attachments added to this manager
String getAvatarUrl(TemplateUser templateUser)
Returns a link to access user avatar in email message.
String getAvatarUrl(String username)
Returns a link to access user avatar in email message.
String getAvatarUrl(ApplicationUser user)
Returns a link to access user avatar in email message.
String getExternalImageUrl(String path)
If the path is a relative url tries to add the image specified as an attachment.
String getImageUrl(String path)
Tries to add image specified by path to email attachments.
String inlineImages(String html)
Tries to inline all the images specified by an IMG tag.

Constants

public static final String CID_PREFIX

Content-ID for generated attachments.

Constant Value: "jira-generated-image-"

Public Methods

public Iterable<BodyPart> buildAttachmentsBodyParts ()

Builds bodyPart for each image (including avatars) added to this manager

Returns
  • Added attachments as list of BodyParts

public int getAttachmentsCount ()

Returns the number of attachments added to this manager

Returns
  • number of attachments

public String getAvatarUrl (TemplateUser templateUser)

Returns a link to access user avatar in email message. If avatar can be attached to email, the cid link is returned, otherwise avatar URL is returned and no image is attached. (E.g. If Gravatar is enabled)

Returns
  • cid link or Avatar URL

public String getAvatarUrl (String username)

Returns a link to access user avatar in email message. If avatar can be attached to email, the cid link is returned, otherwise avatar URL is returned and no image is attached. (E.g. If Gravatar is enabled)

Returns
  • cid link or Avatar URL

public String getAvatarUrl (ApplicationUser user)

Returns a link to access user avatar in email message. If avatar can be attached to email, the cid link is returned, otherwise avatar URL is returned and no image is attached. (E.g. If Gravatar is enabled)

Returns
  • cid link or Avatar URL

public String getExternalImageUrl (String path)

If the path is a relative url tries to add the image specified as an attachment. Returns a cid link if successful, or unchanged path if not

public String getImageUrl (String path)

Tries to add image specified by path to email attachments. Returns image cid link if succeeds or unchanged path if specified path cannot be added as attachment

public String inlineImages (String html)

Tries to inline all the images specified by an IMG tag. Replaces the image url with the cid link or unchanged path if specified path cannot be added as attachment

Parameters
html HTML to change.
Returns
  • The same HTML with the images inlined.