B4J Question SMPT html body issue

ilan

Expert
Licensed User
Longtime User
hi

if i try to send an email with HTML body enabled i am not getting the CSS in the received mail.
i notices that the first letter is cut out of the CSS property. even if i use a url link to <a> tag the first letter is cut

this is an example:

B4X:
Sub sendMail
    Dim smpt As SMTP
    smpt.Initialize("xxx",465,"xxx","xxx","smpt")
    smpt.To.Add("xxx")
    smpt.HtmlBody = True
    smpt.UseSSL = true
    smpt.Subject = "html test"
    smpt.Body = $"<h1 style="background-color:blue; color: white; text-align: center;">This Is a Test</h1><br><a href="https://www.b4x.com">Visit b4x.com</a>"$
    smpt.Send
    Wait For smpt_MessageSent(Success As Boolean)
    If Success Then
        Log("mail sent!")
    Else
        Log("error")  
    End If  
End Sub


Waiting for debugger to connect...
Program started.
mail sent!

1626766493847.png


hovering over the link you can see the the "h" letter is missing and the css style is not applied
changing the code by adding another letter to the property value will solved the issue like this:

smpt.Body = $"<h1 style="bbackground-color:blue; color: white; text-align: center;">This Is a Test</h1><br><a href="hhttps://www.b4x.com">Visit b4x.com</a>"$

note that the red letters are not a typo i just add them so the html code will work. else it is not working!

but why is it like that??

thanx, ilan
 

ilan

Expert
Licensed User
Longtime User
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0
Top