Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Body.html strange characters "\r\n" #171

Closed
MattiaFailla opened this issue Aug 12, 2019 · 4 comments
Closed

Body.html strange characters "\r\n" #171

MattiaFailla opened this issue Aug 12, 2019 · 4 comments

Comments

@MattiaFailla
Copy link

ghhhh

I'm displaying the result of body['html'] in an html page. What can I do to delete all those "new line" characters from the body of the mail? is it a bug?

I'm currently fetching mails from an outlook account.

@MattiaFailla
Copy link
Author

Update: the easiest way to delete those character is via a .replace()
The following characters may appear in you body:

  • \t
  • \n\r
  • \n
  • \r
  • ['\r\n

Example code:
body = body.replace(r"['\r\n", "
")

I'll let this issue open in case of further requests.

@ghost
Copy link

ghost commented Aug 17, 2019

Are you sure that you display the body correctly? The [ at the beginning looks like you are representing a list.

@MattiaFailla
Copy link
Author

Yes, the [ is due to javascript (I'm sending the body from python to javascript via websocket, in order to simulate a callback to the database).

Other characters may appear randomly on emails body (also by printing the body on the terminal). I think is a problem with the formatting of the original mail but I'm not sure tho.

@MattiaFailla
Copy link
Author

Solved by accessing the mail object list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant