Closed Bug 1613535 Opened 4 years ago Closed 4 years ago

Handle message attachments in browser.compose API functions


(Thunderbird :: Add-Ons: Extensions API, enhancement)

Not set


(Not tracked)

Thunderbird 78.0


(Reporter: darktrojan, Assigned: darktrojan)




(2 files)

No description provided.
  1. Could the attachments be saved as a template attachment, i.e the file name being:
    Where the {{attach_x}} could be empty?

  2. Could the {{attach_x}} also be an set of attachments?

This could help with the Mail Merge add-on as then the attachment could be stored with the email. This could help stop accidentally sending emails with attachment from other mail merges.

What do you think?

Thank you

I'm not sure that I completely understand what you're asking for, but I'll explain what I have in mind at the moment as that might help.

  • A listAttachments function which returns the attachments as File objects. I'm not sure if File does everything we need it to but I think it covers most bases: name, size, contents. There's also the question about what to do with FileLink attachments. I don't know, but the answer could be useful for comment 1. I had in mind that the attachments would be automatically listed in the onBeforeSend event and other events, but now I'm not so sure.
  • An addAttachment function. If we're using File this would be great for extension-generated attachments. For using files from the filesystem, we'll first need to figure out what we're doing in terms of filesystem access APIs. There's discussion about that elsewhere so I won't go into it.
  • A removeAttachment function and (I guess) an updateAttachment function.
  • A onAttachmentAdded/Removed/other events, maybe. I'm not sure how useful it would be to know when attachments are removed from a draft.

Bug 1468704 Enable attaching a Template when creating a message
Please see the image Template in the attach bucket

When referencing bugs, please just use "bug" and the number so bugzilla can autolink them properly.

Assignee: nobody → geoff
No longer depends on: 1613534
Attachment #9145732 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9145732 [details] [diff] [review]

Review of attachment 9145732 [details] [diff] [review]:

I wonder if we should accept Blob too
Attachment #9145732 - Flags: review?(mkmelin+mozilla) → review+

The only difference would be that you don't have to provide a file name, but you have to provide a name for the attachment (one way or another) anyway.

Have we understood correctly that this would enable fields, eg. {{field_name}} and image shown in, to be provided as a name for the attachment without providing a file name?

This would be fantastic for the Mail Merge feature.

Thank you

You'll be able to add attachments with a custom name, or rename existing ones to have a custom name, so yes, I think this can do what you want.

Pushed by
Handle message attachments in browser.compose API functions. r=mkmelin

Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 78.0
Pushed by
followup to fix linting. rs=eslint DONTBUILD
Pushed by
follow-up - Fix "this.forgetAttachment is not a function" when closing compose window. rs=me DONTBUILD
You need to log in before you can comment on or make changes to this bug.