How I can get the full "html source" or "original message" of the email body?

Hi, I want to integrate the IMAP email content to fetch gmail and extract info for a sensor, I am following this : IMAP Email Content - Home Assistant

I am getting the body of the email as html, NOT the “html source” or “original message”

Does anyone know – how I can get the full “html source” or “original message” of the email body?

My code:

# email integration
sensor:
  - platform: imap_email_content
    server: imap.gmail.com
    name: new_order_placed
    port: 993
    username: my.assistant
    password: !secret gmail_pswrds
    folder: INBOX
    senders:
      - [email protected]
    value_template: >-
      {% if 'data' in body %}
        body_working
      {% elif 'placed' in subject %}
        sub_working
      {% elif 'forward' in from %}
        from_working
      {% endif %}

What I am getting as body:

friendly_name: new_order_placed
from: [email protected]
subject: Your order has been placed!
date: Wed, 19 Oct 2022 01:35:36 +0000
body: Here's your receipt=0D
=0D
My Dishes logo=0D
=0D
Order Placed=0D
=0D
Your order has=0D
been placed with 2-4-1 Pizza for=0D
=0D
delivery=0D
ASAP.=0D
=0D
Track Order=0D
=0D
ORDER #100214169=0D
=0D
2-4-1 Pizza (Quance St.)=0D
=0D
Placed for=0D
=0D
Delivery=0D
ASAP=0D
=0D
x1=0D
=0D
Fries=0D
=0D
$3.99=0D
=0D
=E2=80=A2 Small=0D
=0D
x1=0D
=0D
2 x 12" Pizza Classic Combo=0D
=0D
$37.68=0D
=0D
=E2=80=A2 14" Large=0D
=0D
=E2=80=A2 Thick Crust (1st Pizza)=0D
=0D
=E2=80=A2 Light Sauce (1st Pizza)=0D
=0D
=E2=80=A2 Banana Peppers (1st Pizza)=0D
=0D
=E2=80=A2 Green Pepper (1st Pizza)=0D
=0D
=E2=80=A2 Pineapple (1st Pizza)=0D
=0D
=E2=80=A2 Salami (1st Pizza)=0D
=0D
=E2=80=A2 Thin Crust (2nd Pizza)=0D
=0D
=E2=80=A2 Teriyaki Sauce (2nd Pizza)=0D
=0D
=E2=80=A2 Banana Peppers (2nd Pizza)=0D
=0D
=E2=80=A2 Chicken (2nd Pizza)=0D
=0D
=E2=80=A2 Ham (2nd Pizza)=0D
=0D
=E2=80=A2 Jalapeno Peppers (2nd Pizza)=0D
=0D
Food/Beverage Total=0D
=0D
$41.67=0D
=0D
Delivery Fee=0D
=0D
$4.99=0D
=0D
PST=0D
=0D
$2.50=0D
=0D
GST=0D
=0D
$2.33=0D
=0D
Tip the Food Courier=0D
=0D
$4.16=0D
=0D
Total (CAD)=0D
=0D
$55.65=0D
=0D
Paid with Credit Card.=0D
=0D
Take the survey envelope=0D
=0D
We want to hear from you!=0D
=0D
Complete our survey and=0D
tell us about=0D
=0D
your experience with MyDishes=0D
=0D
TAKE THE SURVEY=0D
=0D
Instagram =0D
( https://www.instagram.com/mydishes/ )=0D
=0D
Facebook =0D
( https://www.facebook.com/mydishes/ )=0D
=0D
Twitter =0D
( https://twitter.com/myDishes )=0D
=0D
Copyright=0D
=C2=A9 2022=0D
MyDishes, All rights reserved.=0D
=0D
You=0D
are receiving this email because you're=0D
a current account holder with MyDishes.=0D
=0D
Our mailing=0D
address is:=0D
=0D
MyDishes=0D
=0D
Canada

I am actually interested to fetch the following information from email which can only seen in the HTML source / Original message:

<a href=3D"https://edig=
italsurvey.com/survey/enter/s/ESV-vp73-515852109/l/en_CA/theme/STH-vp73-456=
588586/data1/d325458555558555/data2/CA/data3/Berlin" ta=
rget=3D"_blank" title=3D"TAKE MyDishes" style=3D"text-decoration: none; m=
so-line-height-rule: exactly; -ms-text-size-adjust: 100%; -webkit-text-size=
-adjust: 100%;">

I had the same issue. I made a PR to update the integration with a force_html option. With HA moving away from yaml configs a lot of work would need to be done to enable a config flow for the official integration.

I’m not planning to implement all that for such a small feature. You are welcome to still use my modified code, found here. I included some instructions.