问题
I am trying send a email from an Oracle database with an SMTP function with Gmail.
The information is selected with a query in the database, so, for each column I set the space with RPAD
. I make the message with this structure:
l_mailtext := l_mailtext || CHR(9) || LPAD(L_NUMBER, 6, '0') || CHR(9) ||
CHR(9) || CHR(9) || ' ' || I.CONTRACT_REF_NO || CHR(9) ||
RPAD(I.SPEI_TRACE_NO, 40, ' ') ||
RPAD(I.REMARKS, 30, CHR(32)) ||
rpad(I.ACTUAL_AMOUNT, 30, ' ') ||
rpad(I.PC_STATUS, 30, ' ') || CHR(10);
Doing the process, I checked the mail sent and the information shows the following; this is via Gmail in Google Chrome.

I copy and paste the same information in a Notepad++ sheet and it shows me the correct layout:

So, I need the information looks like Notepad ++ in Gmail. I do not know if there is a ASCIIcharacter for padding information. Because information in "Amount" column disorganizes by Payment concept Column in Gmail message.
回答1:
Your data is padded correctly. You've demonstrated that in NP++. Gmail is displaying your email body in a proportional font, where each character is a different width. I figure, you have two options:
Send the email with a header of
Content-type: text/html
and make the body HTML (I think you can do this). You could probably wrap<pre>
tags around your content, which tells the user agent to render it in a fixed-width font with spacing preserved.You could send your content in a .txt attachment, which would likely open up in something like Notepad++, where it would be in a fixed-width font. If they have .txt attachments set to open in Wordpad, that won't be true.
Note that this doesn't really have to do with Gmail. This has to do with the mail client your recipient is using and how you are identifying your content. Today, it may be Gmail, tomorrow, they might switch to Outlook or Thunderbird.
来源:https://stackoverflow.com/questions/51266636/how-to-pad-information-into-columns-for-email