opulentfox-29 / protonmail-api-client

This is not an official python ProtonMail API client. it allows you to read, send and delete messages in protonmail, as well as render a ready-made template with embedded images.
GNU General Public License v3.0
20 stars 7 forks source link

Incorrect mail formatting #15

Closed stefanodvx closed 3 months ago

stefanodvx commented 3 months ago

When sending mail with plain text, every newline character (\n) is ignored.

How to reproduce: Just use the library to send an email that contains new line characters.

Example: "Word1 Word2" will be sent as... "Word1Word2"

opulentfox-29 commented 3 months ago

now you can send text not as html using the is_html=False parameter and the newline character \n will work:

new_message = proton.create_message(
    recipients=['to1@gmail.com'],
    subject='hello',
    body='hello1\nhello2'
)
message = proton.send_message(new_message, is_html=False)

but in html mode you will have to use <br/>

new_message = proton.create_message(
    recipients=['to1@gmail.com'],
    subject='hello',
    body='hello1<br/>hello2'
)
message = proton.send_message(new_message, is_html=True)