Reputation: 15797
A VB6 applications sends a HTML email. Please have a look at the code below. The email received has all the blank spaces stripped out i.e. all of the spaces on line 7 are stripped out and the email sent says: "this is a test". Is there a way to send a HTML email with all of the spaces.
strMailText = strMailText & "<b><font size=""2"" face=""Arial""><br>Test Email</font></b><br><br>"
strMailText = strMailText & "<table border='1'>"
strMailText = strMailText & "<tr>"
strMailText = strMailText & "<td><b><font size=""2"" face=""Arial"">Test Column</font></b></td>"
strMailText = strMailText & "</tr>"
strMailText = strMailText & "<td><font size=""2"" face=""Arial"">This is a test</font></td>"
strMailText = strMailText & "<tr>"
strMailText = strMailText & "table"
SendEMail strEmailServer, "[email protected]", strEMailTo, _
"Test Email", strMailText, True
Upvotes: 0
Views: 5636
Reputation: 21
Our findings from using Litmus to test these methods
While
is supported by many email clients, some, such as Gmail (web) and iPhone Mail cause small anchor text underline spaces to be shown in some cases if an <a href="">
happens to be nearby.
Trying the <span style="padding-left: 15px;"></span>
method, sadly, some email clients such as Outlook 2010, Outlook 2013, and Outlook 2019 simply show no space whatsoever.
But replacing these with something like img src="pixels.gif" width="15" height="2" style="border: none; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic;">
(a simple blank gif to force the space) is supported by absolutely every single email client in Litmus. (Note that we don't use a 1px x 1px sized gif, as we've heard that this could potentially lead to the email being marked as spam. Alternatively, we use a 2x2 gif.)
Upvotes: 2
Reputation: 9469
use
instead of blank spaces.
 
In computer-based text processing and digital typesetting, a non-breaking space, no-break space or non-breakable space (NBSP) is a variant of the space character that prevents an automatic line break (line wrap) at its position.
So this line
`strMailText = strMailText & "<td><font size=""2"" face=""Arial"">This is a test</font></td>"`
should be written as:
strMailText = strMailText & "<td><font size=""2"" face=""Arial"">This is a test</font></td>"
Edited:
OR Another Method
Use a <span>
tag instead of spaces and give it padding or margins like this
<span style='padding-left: 15px;'></span>
So it should look like:
strMailText = strMailText & "<td><font size=""2"" face=""Arial"">This is<span style='padding-left: 15px;'></span>test</font></td>"
Upvotes: 7
Reputation: 131
Most html rendering engines collapse multiple consecutive spaces. try writing instead of space, non-breaking spaces:
or  
Upvotes: 2
Reputation: 1174
HTML strips out multiple spaces and replaces it by a single one. To solve your problem use
instead of space.
strMailText = strMailText & "<td><font size=""2"" face=""Arial"">This is a test</font></td>"
Upvotes: 0