#1
  1. Purple is a Fruit
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    404
    Rep Power
    170

    Simple (Hopefully!) CDONTS Question


    Hey,

    I have a script sending mail with asp using CDONTS. The script works fine, the only problem I have is specifying a new line in the message body. I am used to php's imap commands where you can just set the body to be "Hi\nThis is on a new line!" but putting \n in the text of the CDONTS mail just displays the \n as part of the text. Any ideas on how to set a new line in the text?

    Thanks for reading
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    23
    Rep Power
    0
    Have you tried using the HTML <br> tag?
  4. #3
  5. Purple is a Fruit
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    404
    Rep Power
    170
    Hey,

    No, I don't want to send the mail as a html mail. Just as a plain text mail. I presume the newline character for text is \n, I'm just not sure how to implement it using CDONTS...

    Thanks
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    29
    Rep Power
    0
    I think the problem is that php doesn't interpret what's between quotes. In VBScript, the solution is:

    "Hi" & vbNewLine & "This is on a new line."

    vbNewLine is a pre-defined character string that contains a hard return and a linefeed -- chr(13) & chr(10)

    I think you need to do the same thing in php -- glue together two strings, with a third string made up of a hard return and a linefeed between the two.

    Sorry, I don't speak php. But hopefully you can translate from the VBS example above.

    Charlie

    Comments on this post

    • Gran Roguismo agrees
  8. #5
  9. Purple is a Fruit
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    404
    Rep Power
    170
    Hey,

    Thanks that worked a treat. Oddly in PHP, it's enough to just place the \n character within the quotes and it will create a newline.

    Thanks again
  10. #6
  11. Second highest poster :p
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2001
    Posts
    7,322
    Rep Power
    33
    Welcome to the differences in Structured and Unstructured Programming. VB is unstructured code. PHP, Java, C is structured.

    What does this mean? In structured languages you have ; at the end of lines, if statements use () to hold the condition, \n \t \r etc is available, using {} to denote code areas, the list goes on

    On unstructured languages you dont have anything to denote end of lines, if statements have if condition then do this which is more like english and less like programming. Also things like all the special characters are not available. You use things like endif and wend to close code areas.

    This is just a breif outline of the differences.
    - Andreas Koepke

    Koepke Photography

  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    London
    Posts
    1
    Rep Power
    0

    Angry


    oh please!

    what you are harping on about there are differences in syntax.
    these have nothing whatsoever to do with structure.

    vb is as structured as those other languages you mention, regardless of whether or not you can get you head around the syntactical differences.
  14. #8
  15. Second highest poster :p
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2001
    Posts
    7,322
    Rep Power
    33
    Have you any formal programming training? Structured & Unstructured are simple programming concepts and are general categories.

    BASIC code uses stuff like "if condition then this else that" and "goto overthere" meaining its unstructured. VB is based on BASIC. It has been called that since the languages were developed. Things like C were always known as structured since they had functions and code looked like "if (condition) { this; } else { that; }".

    VB has functions and some of the things that structured programming has but its still refered to as an unstructured language. Take a step back in history and read this http://www.chisp.net/~dminer/c64/gaz...1/8801088.html
    It may be old but it shows what i mean.
    Last edited by a.koepke; February 24th, 2003 at 09:15 AM.
    - Andreas Koepke

    Koepke Photography


IMN logo majestic logo threadwatch logo seochat tools logo