paul bennett

Archive for the ‘asp’ Category

In case you find yourself (as I have on a recent project) delving into the seedy underbelly of a server-side you’re neither familiar with or particularly fond of (*cough*ASP*cough*), here’s a couple of gems which may help you out.

ASP has plenty of gotcha’s (as does any programming language to be sure) so here are solutions to a couple of my common problems.

Sending email

Actually pretty simple, but I can across a couple of different ways of doing it. This is the way that actually worked.

Set myMail=CreateObject("CDO.Message")
myMail.Subject="I de best"
myMail.From="webserver@mydomain.org.nz"
myMail.To="billy@johnsue.net"
myMail.TextBody="Behold! The email content!."
myMail.Send
set myMail=nothing

Inserting line feeds

In order to stop your email text from loking like the blancmange of doom, you’ll need to insert some line break / line feed characters. I spent an inordinate amount of time looking for how to achieve this. (Is there anything like php.net for asp? Some of the online ‘documentation’ leaves a lot to be desired…)

Return (VB ‘carriage return’):

myMessage = “hello.” & vbCr & “My name is Trevor”

Return and New Line (VB ‘carriage return and line feed’):

myMessage = “Hello, my name is Trevor” & vbCrLf & “What be your name?”


Archives