ASP - new line

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adreampicture
    New Member
    • Jan 2008
    • 1

    ASP - new line

    Hello!
    Could somebody help me with my code? The problem is - I can't make vbcrlf work for the plain text e-mail. If I am using vbcrlf people getting unformatted text (no new lines). Same as if I preview it in browser using Response.Write( strBodyText) --- see below.

    If I use "<br>" instead of vbcrlf than users are getting text displaying <BR> "Dear Name<br>text... ..<br>Thank you, etc"
    Please advise how to send plain text e-mail with carriage return correctly.
    P.S. I tryed Chr(13), Chr (10), vbnewline - nothing helps.... :(
    Thanks

    [PHP]<%
    Dim objMyMessage, objMyConfigurat ion
    Set objMyMessage = Server.CreateOb ject("CDO.Messa ge")
    Set objMyConfigurat ion = Server.CreateOb ject ("CDO.Configura tion")

    objMyConfigurat ion.Fields("htt p://schemas.microso ft.com/cdo/configuration/sendusing") = 2
    objMyConfigurat ion.Fields("htt p://schemas.microso ft.com/cdo/configuration/smtpserver") = "mail.server.co m"
    objMyConfigurat ion.Fields("htt p://schemas.microso ft.com/cdo/configuration/smtpserverport" ) = 25
    objMyConfigurat ion.Fields("htt p://schemas.microso ft.com/cdo/configuration/smtpusessl") = False
    objMyConfigurat ion.Fields("htt p://schemas.microso ft.com/cdo/configuration/smtpconnectiont imeout") = 60
    objMyConfigurat ion.Fields("htt p://schemas.microso ft.com/cdo/configuration/smtpauthenticat e") = 1 'basic (clear-text) authentication
    objMyConfigurat ion.Fields.Item ("http://schemas.microso ft.com/cdo/configuration/sendusername") ="info@server.c om"
    objMyConfigurat ion.Fields.Item ("http://schemas.microso ft.com/cdo/configuration/sendpassword") ="password"

    objMyConfigurat ion.Fields.Upda te
    Set objMyMessage.Co nfiguration = objMyConfigurat ion

    strBodyText = "Dear somebody" & vbNewLine
    strBodyText = strBodyText &"Thank you," & vbcrlf
    strBodyText = strBodyText & "text"

    objMyMessage.To = "to@email.c om"
    objMyMessage.Fr om = "from@email.com "
    objMyMessage.Su bject = "RE: subject"
    objMyMessage.TE XTBody = strBodyText
    'objMyMessage.S end

    Set objMyMessage = Nothing
    Set objMyConfigurat ion = Nothing

    Response.Write( strBodyText)

    %>[/PHP]
  • ilearneditonline
    Recognized Expert New Member
    • Jul 2007
    • 130

    #2
    Originally posted by adreampicture
    [PHP]<%
    strBodyText = "Dear somebody" & vbNewLine
    strBodyText = strBodyText &"Thank you," & vbcrlf
    strBodyText = strBodyText & "text"

    objMyMessage.To = "to@email.c om"
    objMyMessage.Fr om = "from@email.com "
    objMyMessage.Su bject = "RE: subject"
    objMyMessage.TE XTBody = strBodyText
    'objMyMessage.S end

    Set objMyMessage = Nothing
    Set objMyConfigurat ion = Nothing

    Response.Write( strBodyText)

    %>[/PHP]
    Have you tried using... I am not sure it will work but I got in the habit of using "\n" when i wanted a new line.
    [PHP]
    strBodyText = "Dear somebody" & "\n"
    strBodyText = strBodyText &"Thank you," & "\n"
    strBodyText = strBodyText & "text" [/PHP]

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      you could also try vbNewLine, but I thought the output was supposed to be the same as for vbcrlf

      Comment

      • Nicodemas
        Recognized Expert New Member
        • Nov 2007
        • 164

        #4
        You could try using vbCrLf

        Comment

        Working...