Miksus/red-mail

How can I send multiple images using html?

Opened this issue · 1 comments

I really need that function but Idk how to do it. Can you show me some examples?

I'm using a dict for the images. This way the images also have a proper name in the text and are shown inline when sending to outlook.

body_images = {
    f'plot_{i+1}': {
        "content": fig,
        'subtype': 'png',
        'maintype': 'image',
        'filename': f'plot_{i+1}.png'
    } for i, fig in enumerate(fig_list)
}

email.send(
    subject=subject,
    sender=sender,
    receivers=receivers,
    html="""
        <p>{{ bodytext }}</p>
        {{ plot_1 }}
        {{ plot_2 }}
        {{ plot_3 }}
    """,
    body_params={
        "bodytext": bodytext,
    },
    body_images=body_images,
)

Does this help you further?