anoved / OctoPrint-EmailNotifier

Receive email notifications when OctoPrint jobs are complete. Currently broken. Please fork and fix!
GNU Affero General Public License v3.0
16 stars 35 forks source link

Use explicit destination filename for snapshot #26

Closed doughoyt closed 7 years ago

doughoyt commented 7 years ago

Should fix #5 and fix #18

yagmail tries to "guess" MIME type for attachments using filename extension. However, urllib.urlretrieve writes retrieved content to a temporary file with no extension, so yagmail is unable to determine that attachment is an image and use the correct content-type. By using an explicit destination filename with a ".jpg" extension, yagmail will use Content-type: image/jpeg for the MIME object and, hopefully, email clients will handle appropriately [#18].

Also, by using the yagmail inline type, image will be embedded in the body of the email's HTML part rather that as an attachment (on yagmail>=0.5.156) [#5]. Note that this may be undesirable to some--if they prefer it as a true attachment, rather than inline. Might be better to have this as a configuration option?