Joe Clifford
Joe Clifford

Reputation: 68

How do hard code HTML in VB for the Body of an email?

Sorry if that title wasn't very easy to get the gist of. This is my first post.

Basically within my program is the option to send an email. Its an E-Ticket. I have set 'IsBodyHtml' to true. It sends it fine. No problems at all.

Within the HTML code however I want to insert some fields that are relevant to each customer.

When I put set ETicket.Body = to the HTML Code I get a number of errors because words such as 'Width' and 'Height' etc are being picked up as VB words.

As a short term fix so I could test that the HTML body actually works I put the code into a rich text box and then set ETicket.Body = RichTextBox1.Text . It works, but doesn't have the data in it that I want.

The data relevant to each customer is held in an array. Any idea how I can get the HTML code to be accepted by VB? Or how I can get my data from the array into the relevant position in the rich text box?

Thankyou!

Joe

Upvotes: 0

Views: 459

Answers (1)

Paul Grimshaw
Paul Grimshaw

Reputation: 21044

This will likely be due to the double quotes in the HMTL markup. Try doing a find and replace on the HTML, and replace double quotes (") with single ones (').

Upvotes: 1

Related Questions