Closed paradox-lab closed 3 years ago
The problem has been solved.
On CentOS 7 it need to install a package named "mailcap":
yum install mailcap
execute script:
In [1]: mimetypes.guess_type('/home/zhao.jz.2/aje/aje/download/webdriver/CaseInfo_20210324-Reports_summary.xlsx')
Out[1]: ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', None)
then Content-Type become 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'.
I attach xlsx files to emails that I send, but it cannot be displayed on the client.
expect :
actual:
I found the reason is that the value of Content-Type is None/None.
content_object["main_type"] get from mimetypes.guess_type, but it return None
when content_object["main_type"] is None and content_object["encoding"] == "base64", content_object["main_type"] and content_object["sub_type"] can't get any value.
yagmail/message.py line:206
Finnally,the value of Content-Type is None/None.
How should I deal with this kind of problem?