I have managed to fudge together a working asp contact form using cdosys. To prepare the body for the email I am using Dim Body Body = "<p><font face=Arial size=2 color=#333333>" & vbcrlf Body = Body & "Title: " & title & VbCrLf & "<br>" Body = Body & "First Names: " & first_name & VbCrLf & "<br>" Body = Body & "Surname: " & sur_name & VbCrLf & "<br>" Body = Body & "Date of Birth: " & date_of_birth & VbCrLf & "<br>" Body = Body & "E-mail address: " & email & VbCrLf & "<br>" Body = Body & "Address: " & address & VbCrLf & "<br>" Body = Body & "Home Phone: " & home_phone_international_dialing_code & " " & home_phone & VbCrLf & "<br>" Body = Body & "Mobile Phone: " & mobile_phone_international_dialing_code & " " & mobile_phone & VbCrLf & "<br>" Body = Body & "How did you hear about us: " & how_did_you_hear & VbCrLf & "<br>" Body = Body & "What company are you travelling with: " & what_company_are_you_travelling_with & VbCrLf What I would really like is the above information to be emailed in a styled table rather than just the text being altered to arial. I am not that experienced with this so any help would be greatly appreciated.
You just use regular html: Body = "<table><tr><td>Title:</td><td>" & title & "</td></tr>" ... etc. etc. I'm assuming that you can use CSS in emails so just use css to style it.
You are using it for sending email. Why not try a saved html file like: Dear [Username], Sub: [Subject] This is for an example and [your dynamic content goes here] Thank you [sender] Then your can use the saved html file by using Streamreader. streamreader reader=new streamreader(); string body=writer.readtoEnd(); body.Replace("[Username]","Yourstring"); then send your mail.
There is no need to use a streamreader, CDOSYS has built in functionality to include a html file (source: http://www.w3schools.com/asp/asp_send_email.asp): <% Set myMail=CreateObject("CDO.Message") myMail.Subject="Sending email with CDO" myMail.From="mymail@mydomain.com" myMail.To="someone@somedomain.com" myMail.CreateMHTMLBody "http://www.w3schools.com/asp/" myMail.Send set myMail=nothing %> Code (markup):