Can we format the email body in EmailTools

I’m building a simple AI-powered newsletter agent where one agent performs web searches to gather information, and another agent sends emails to users. However, I’m facing issues with formatting the email content. It seems like only plain text is supported, and my attempts to include structured formatting haven’t worked.

Does anyone know if these EmailTools support HTML formatting, or is there a better way to make the email content more readable and visually appealing? Any tips or examples would be greatly appreciated!"

Hi @anandhukrishna091
Thank you for reaching out and using Phidata! I’ve tagged the relevant engineers to assist you with your query. We aim to respond within 24 hours.
If this is urgent, please feel free to let us know, and we’ll do our best to prioritize it.
Thanks for your patience!

Hey @anandhukrishna091 you can try to give a response_model to the agent to get the response in a pydantic model format. You can also try to add instructions param in your agent config to tell it to give output in HTML formatting

1 Like

Hello @anandhukrishna091!

The EmailTools toolkit is using smtplib under the hood and the Agent returns a simple string which is used as the body of the email. For your custom use-case, you create a new toolkit with custom formatting for the email.

Alternatively, you can use ResendTools with an html template and get the agent to return data which you can place in your template.

Do let us know if you have any issues.

1 Like