change email Content headers when using Gmail API

507 views Asked by At

I successfully sent email using Gmail API. I noticed that the text is put to new line every 66-69 characters. This way the text, fills only half of screen. Any idea how to set it to fill entire space available?

To send emails, I use this github project: https://github.com/chris-brown-nz/python-gmail-api

Headers regarding content are:

Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I have a feeling that I need to change Content-Type and Content-Transfer-Encoding headers in order to make text fill entire space available. Any idea how to do this?

EDIT: I added this code,

message = MIMEText(message_body, 'html')

to the __create_message function and now the text isnt put to new line every 68 characters. But this caused new issue. Now API ignores any new line argument set intentionally by me.

EDIT: adding <br> works for HTML based emails. What about plain text emails?

Perhaps a better question is, how to add option to display as html and plain text?

0

There are 0 answers