1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Contact Form

Discussion in 'C#' started by jimmyw25, Aug 24, 2010.

  1. #1
    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 & "&nbsp;" & home_phone & VbCrLf & "<br>"
    Body = Body & "Mobile Phone: " & mobile_phone_international_dialing_code & "&nbsp;" & 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.
     
    jimmyw25, Aug 24, 2010 IP
  2. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    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.
     
    camjohnson95, Aug 24, 2010 IP
  3. nagarajang

    nagarajang Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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.
     
    nagarajang, Aug 25, 2010 IP
  4. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    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):
     
    camjohnson95, Aug 25, 2010 IP
  5. GeekOnline

    GeekOnline Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Is it easy cache-able?
     
    GeekOnline, Aug 27, 2010 IP
  6. susasl

    susasl Active Member

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #6
    What do you mean by cache-able?
     
    susasl, Aug 28, 2010 IP