Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP email (cdonts)
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP email (cdonts)

 Post Reply Post Reply
Author
Pcbaltimore View Drop Down
Newbie
Newbie


Joined: 25 April 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pcbaltimore Quote  Post ReplyReply Direct Link To This Post Topic: ASP email (cdonts)
    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
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Pcbaltimore View Drop Down
Newbie
Newbie


Joined: 25 April 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pcbaltimore Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2005 at 3:40pm
how do i actually change the value
 
field 1
 
to
 
name
 
or email
 
thanks for the help
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2005 at 8:26pm
mbody = "name: " & contactfield1 & vbCRLF & "email: " & contactfield2 & vbCRLF & "phone: " & contactfield3 & vbCRLF & "reason: "&contactfield4
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.