DevCoder
DevCoder

Reputation: 536

Python :Format changed during sending email

I'm new in python. I'm sending some big text mail through python.What I'm doing is that I'm storing that big text mail in one single string and sending that. When I'm printing that string at my side I'm getting well formatted as per my desire but on receiver side format of message getting changed.How can I ensure that tabular format of my message sud not get changed. When I print message I get sumthing like this:

Click Count for all 24 hrs:
===================
      Citrus_click      Hadoop_click              Diff
          10224172                 0          10224172

Billed Count for all 24 hrs:
===================
       Citrus Leaf            Hadoop              Diff
           8055239                 0           8055239

Beacon Count for all 24 hrs:
================
       Citrus Leaf            Hadoop              Diff
            900476                 0            900476

Beacon unique Count for all 24 hrs:
===================
       Citrus Leaf            Hadoop              Diff
             43516                 0             43516

But format changed at recievers side and they get sumthing like this:

Click Count for all 24 hrs:
===================
      Citrus_click      Hadoop_click              Diff
             10224172         0              10224172

Billed Count for all 24 hrs:
===================
       Citrus Leaf            Hadoop              Diff
           8055239              0            8055239

Beacon Count for all 24 hrs:
================
       Citrus Leaf            Hadoop              Diff
         900476                 0                   900476

Beacon unique Count for all 24 hrs:
===================
       Citrus Leaf            Hadoop              Diff
          43516                 0                   43516

Upvotes: 2

Views: 772

Answers (1)

John Zwinck
John Zwinck

Reputation: 249394

This was a comment, but now it's an answer!

Is the receiving side using a variable-width font? If so, try explicitly setting a font in your mail, or changing the mail program's setting to use a monospaced font for plaintext messages.

If you want to force monospace formatting, try making your message body be HTML like this:

<html><body><pre>
your stuff goes here
</pre></body></html>

The pre tag is the important bit: it tells the client program that the text is already formatted as monospace, so it should be displayed like that.

Upvotes: 1

Related Questions