0

I'm using python to send the contents of a file to an email using this approach:

f = open(file,"r")
contents = f.read()

Inside the html code I put:

        <head></head>
        <body>
        <h1>Alerta</h1>
        <p>{contents}</p>
        </body>
        </html>
                    """.format(contents=contents)

The file looks like this:

phrase 1
phrase 2
phrase 3
phrase 4

But in the email i got:

phrase 1 phrase 2 phrase 3 phrase 4

Is there a way to get the email in a similar way to the original file?

David López
  • 500
  • 5
  • 21

0 Answers0