Print Page | Close Window

ASP email (cdonts)

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=14825
Printed Date: 30 March 2026 at 6:55am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: ASP email (cdonts)
Posted By: Pcbaltimore
Subject: ASP email (cdonts)
Date Posted: 25 April 2005 at 12:37pm

hello all

i am new to asp and have a simple question, my hosting company sent me to this forum for help.

i have a server document its contact.asp, and i seem to have the code right, but i want to change the way the form sends theh data.

code is below

<%

contactfield1=Request("field1")

contactfield2=Request("field2")

contactfield3=Request("field3")

contactfield4=Request("field4")

 

mbody = "field1 : "&contactfield1&" | field2 : "&contactfield2&" | field3 : "&contactfield3&" | field4 : "&contactfield4

'email object for cdonts

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'Set pmail = pop.secureserver.net("CDONTS.Newmail")

'change the email to your email address

'pmail.From = "admin@pcbaltimore.com"

'pmail.To = "admin@pcbaltimore.com"

'pmail.Subject = " Website Contact enquiry "

'pmail.Body = mbody

'pmail.MailFormat = 0 'mime type

'pmail.BodyFormat = 0 'default value 1 for plain text type

'pmail.Send

'Set pmail=Nothing

'new mail

'DIM Mailer

 

'email object for CDO Windows 2003

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Set objMessage = CreateObject("CDO.Message")

objMessage.Subject = "Website Contact Enquiry"

'change the email to your email address

objMessage.Sender = "admin@pcbaltimore.com"

objMessage.To = "admin@pcbaltimore.com"

objMessage.TextBody = mbody

objMessage.Send

set objMessage=Nothing

response.write("response=ok")

%>

this is how the mail comes in:
 
field1 : Gerald Smith | field2 : a@a.com | field3 : 207-456-5634 | field4 : My pc freezes when it boots!

i want it to say

name:
email
phone
reason
ANY help would be great. thanks



Replies:
Posted By: dpyers
Date Posted: 25 April 2005 at 3:36pm

Chang the line

Quote mbody = "field1 : "&contactfield1&" | field2 : "&contactfield2&" | field3 : "&contactfield3&" | field4 : "&contactfield4
to
Quote mbody = "field1 : " & contactfield1 & vbCRLF & "field2 : " & contactfield2 & vbCRLF & "field3 : " & contactfield3 & vbCRLF & "field4 : "&contactfield4

This will put a Carriage-Return/Line-Feed (vbCRLF is an asp constant) at the end of each name-value pair.
 
Also, change Request("field1") to Request.Form("field1")
This will ensure than values only come from the form and will prevent spammers from passing them to you through a query string.


-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: Pcbaltimore
Date Posted: 25 April 2005 at 3:40pm
how do i actually change the value
 
field 1
 
to
 
name
 
or email
 
thanks for the help


Posted By: ub3rl337ch3ch
Date Posted: 25 April 2005 at 8:26pm
mbody = "name: " & contactfield1 & vbCRLF & "email: " & contactfield2 & vbCRLF & "phone: " & contactfield3 & vbCRLF & "reason: "&contactfield4



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net