Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Have names to the inline images #48

Open
Miksus opened this issue May 23, 2022 · 2 comments
Open

ENH: Have names to the inline images #48

Miksus opened this issue May 23, 2022 · 2 comments
Labels
enhancement New feature or request MIME Related to MIME structures and parts

Comments

@Miksus
Copy link
Owner

Miksus commented May 23, 2022

Is your feature request related to a problem? Please describe.
The inline images are attached as "noname":
image
or more specifically, without a name. For library users that use it to send emails to clients, this may not be nice as that might sound unprofessional and suspicious.

Describe the solution you'd like
An option to give a name to the inline-image. Possibly have another name by default than "noname".

Describe alternatives you've considered
Serve the image from a server.

@Miksus Miksus added enhancement New feature or request MIME Related to MIME structures and parts labels May 23, 2022
@Miksus
Copy link
Owner Author

Miksus commented May 24, 2022

There is also one more alternative by passing the image as dict:

from pathlib import Path

email.send(
    receivers=[...],
    subject="Example",
    html='''
        <p>Image (PNG):</p>
        <br>{{ dict_image }}
    ''',
    body_images={
        'dict_image': {
            "content": Path("image.png").read_bytes(),
            'subtype': 'png',
            'maintype': 'image',
            'filename': 'a_media.png'
        },
    }
)

@darkvertex
Copy link

Is there a way to still embed inline without it appearing as an attachment in the email list view?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request MIME Related to MIME structures and parts
Projects
None yet
Development

No branches or pull requests

2 participants