Send asp HTML

I want to add some html to the email. I have tried the following.

vFromName = "someone"
vFromAddress = "someemail"
vTo = "recipient"
vSubject="someSubject"
vBodyofemail = "<html><table><tr><td><b>SomeText</b></td></tr></table></html>"

Call SendMail()

sub SendMail()
  'change to address of your own SMTP server
  strHost = "mail.internal.rouses.com"
  Set Mail = Server.CreateObject("Persits.MailSender")
  'enter valid SMTP host
  Mail.Host = strHost
  'From eMail address
  Mail.FromName = vFromName
  'From address
  Mail.From = vFromAddress 
  'To eMail address
  Mail.AddAddress vTo
  'message subject
  Mail.Subject = vSubject
  'message body
  Mail.Body = vBodyOfEmail
 Mail.Send
end sub

How can i do this? I tried Mail.HtmlBody, but this does not work either. The email is sent, but all I see is the tags that the html is in.

+3
source share
3 answers

According to this page, you need to set the IsHTML flag to true.

strHTML = "Hello world"

Mail.IsHTML = True
Mail.Body = "<HTML><BODY><CENTER>" & strHTML & "</CENTER></BODY></HTML>"
+3
source

Try adding this line above the send call.

Mail.IsHTML = true

Without it, the Mail object by default has standard text, and everything that is entered into the Body property will be displayed in the message as text.

+3
source

, ? .

(And people like me prefer to switch to plain text if your HTML / CSS doesn't display well. See the CSS Client Support Guide for Email Clients (2008) and the Draft Email Standards list .)

0
source

Source: https://habr.com/ru/post/1711820/


All Articles