Closed Bug 1613535 Opened 4 years ago Closed 4 years ago

Handle message attachments in browser.compose API functions

Categories

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

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 78.0

People

(Reporter: darktrojan, Assigned: darktrojan)

References

Details

Attachments

(2 files)

No description provided.
  1. Could the attachments be saved as a template attachment, i.e the file name being:
    {{attach_1}}
    {{attach_2}}
    ...
    {{attach_n}}
    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
Status: NEW → ASSIGNED
No longer depends on: 1613534
Attachment #9145732 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9145732 [details] [diff] [review]
1613535-api-attachments-1.diff

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 https://bugzilla.mozilla.org/show_bug.cgi?id=1613535#c3, 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 thunderbird@calypsoblue.org:
https://hg.mozilla.org/comm-central/rev/10edd0b97102
Handle message attachments in browser.compose API functions. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 78.0
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/d99e95524b9b
followup to fix linting. rs=eslint DONTBUILD
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/2a5f7a05bc2c
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.