Bryan Thai
Bryan Thai

Reputation: 179

How to insert image in Yagmail? (Python)

I have a Yagmail script where I want to send an email formated like so:

Hello! Below is a picture.

img.png

Goodbye!

However, my script is just sending the image all the way at the bottom of the email. Here is my code:

img = "img.PNG"
body = "Hello! Below is a picture." + img + "Goodbye!"

contents = [body, img]
yag.send("[email protected]", "Subject", contents)

How would you send an email using a format where you can position the image between blocks of text? Help is appriciated!

Upvotes: 5

Views: 749

Answers (1)

Zou Angus
Zou Angus

Reputation: 21

contents = [yagmail.inline("/path/to/local/image")]

Upvotes: 1

Related Questions