Helpful Information
 
 
Category: ASP Programming
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 :)

Have you tried using the HTML <br> tag?

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

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

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 :)

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.

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.

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/gazette/8801/8801088.html
It may be old but it shows what i mean. :)










privacy (GDPR)