red-box icon indicating copy to clipboard operation
red-box copied to clipboard

Obtaining Email Message HTML body error

Open mdp18 opened this issue 2 years ago • 2 comments

Hi there, I get the following error when attempting to get an html email via redbox.

Traceback (most recent call last): File "/Users/max/support-bot/sandbox.py", line 45, in <module> test2() File "/Users/max/support-bot/sandbox.py", line 43, in test2 print(emails[0].html_body) File "/Users/max/.local/share/virtualenvs/support-bot-ZEAB9n9N/lib/python3.10/site-packages/redbox/models/message.py", line 48, in html_body return insp.get_html_body() File "/Users/max/.local/share/virtualenvs/support-bot-ZEAB9n9N/lib/python3.10/site-packages/redbox/utils/inspector.py", line 15, in get_html_body content_type = pl['Content-Type'].split(";") TypeError: string indices must be integers

Any insight would be great.

mdp18 avatar May 10 '23 01:05 mdp18

Bump, same issue when attempting to get msg.text_body. I think inside of the Inspector class, the get methods use the self.message,get_payload() function. The variable is then indexed with pl['content-type'] and throws an error. My hypothesis is that the function has changed from returning a dictionary to returning a list and now the variable pl must be indexed with pl[0] or pl[1].

meap02 avatar Nov 29 '23 21:11 meap02

Bump, same thing happens here with msg.html_body. Weirdly enough, it doesn't happen when I use Outlook to send my bot an email.

wompking avatar Dec 05 '23 21:12 wompking