473,498 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can i change CDONTS values to CDOSYS?

I have the follwing code and cannot receive e mails sent from my contact
form. Please advise how can i make it work with CDOSYS. Thank you.

<%
form_from = "in**@nnn.com"
form_to = "in**@nnn.com"
form_cc = Request.Form("mail_cc")
form_bcc = Request.Form("mail_bcc")
form_subject = "Reality Form Submission"
form_importance = 1

FOR x = 1 TO Request.Form.Count
IF Request.Form.Key(x) = "mail_from" OR Request.Form.Key(x) = "mail_to" OR
Request.Form.Key(x) = "mail_cc" OR Request.Form.Key(x) = "mail_bcc" OR
Request.Form.Key(x) = "mail_subject" OR Request.Form.Key(x) =
"mail_importance" OR Request.Form.Key(x) = "mail_redirect" OR
Request.Form.Key(x) = "mail_send" OR Request.Form.Key(x) = "Submit" THEN
form_variables = form_variables
ELSE
form_variables = form_variables & Request.Form.Key(x) & ": " & vbcrlf &
Request.Form.Item(x) & vbcrlf & vbcrlf
END IF
NEXT

DIM body_text
body_text = vbcrlf & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf
body_text = body_text & form_subject & vbcrlf
body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf
& vbcrlf
body_text = body_text & form_variables
body_text = body_text & "Sent from: " & vbcrlf &
Request.ServerVariables("HTTP_REFERER") & vbcrlf & vbcrlf
body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf
<!--SET objMail = Server.CreateObject("CDONTS.NewMail")-->

SET objMail = CreateObject("CDO.Message")

<!--objMail.BodyFormat = 1-->
<!--objMail.MailFormat = 1-->

objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="127.0.0.1"

objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
objMail.Configuration.Fields.Update
objMail.From = form_from
objMail.To = form_to
objMail.CC = form_cc
objMail.BCC = form_bcc
objMail.Subject = form_subject
<!--objMail.Importance = form_importance-->
objMail.TextBody = body_text
objMail.Send
SET objMail = NOTHING

Response.Write("")
%>

Mar 22 '08 #1
1 1755
"beyaz" <be***@discussions.microsoft.comwrote in message
news:7D**********************************@microsof t.com...
I have the follwing code and cannot receive e mails sent from my contact
form. Please advise how can i make it work with CDOSYS. Thank you.

<%
form_from = "in**@nnn.com"
form_to = "in**@nnn.com"
form_cc = Request.Form("mail_cc")
form_bcc = Request.Form("mail_bcc")
form_subject = "Reality Form Submission"
form_importance = 1

FOR x = 1 TO Request.Form.Count
IF Request.Form.Key(x) = "mail_from" OR Request.Form.Key(x) = "mail_to" OR
Request.Form.Key(x) = "mail_cc" OR Request.Form.Key(x) = "mail_bcc" OR
Request.Form.Key(x) = "mail_subject" OR Request.Form.Key(x) =
"mail_importance" OR Request.Form.Key(x) = "mail_redirect" OR
Request.Form.Key(x) = "mail_send" OR Request.Form.Key(x) = "Submit" THEN
form_variables = form_variables
ELSE
form_variables = form_variables & Request.Form.Key(x) & ": " & vbcrlf &
Request.Form.Item(x) & vbcrlf & vbcrlf
END IF
NEXT

DIM body_text
body_text = vbcrlf & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf
body_text = body_text & form_subject & vbcrlf
body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &
vbcrlf
& vbcrlf
body_text = body_text & form_variables
body_text = body_text & "Sent from: " & vbcrlf &
Request.ServerVariables("HTTP_REFERER") & vbcrlf & vbcrlf
body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &
vbcrlf
>

<!--SET objMail = Server.CreateObject("CDONTS.NewMail")-->

SET objMail = CreateObject("CDO.Message")

<!--objMail.BodyFormat = 1-->
<!--objMail.MailFormat = 1-->

objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="127.0.0.1"

objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
objMail.Configuration.Fields.Update
objMail.From = form_from
objMail.To = form_to
objMail.CC = form_cc
objMail.BCC = form_bcc
objMail.Subject = form_subject
<!--objMail.Importance = form_importance-->
objMail.TextBody = body_text
objMail.Send
SET objMail = NOTHING

Response.Write("")
%>

The code looks a little weird but should work.

What error are you getting?
Are there errors in the event log on your system?
Do the emails end up in the bad mail folder or just sit in the queue of your
SMTP server?
Have you checked that your SMTP allows relay from 127.0.0.1?

--
Anthony Jones - MVP ASP/ASP.NET
Mar 22 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4313
by: CK | last post by:
Hi all, I know this question is stupid. But i need some advice for this. I am trying to develop a website, which will allow the user send to order form to the admin email. I am planning to use the...
1
1588
by: Paxton | last post by:
Is it necessary to set field configurations for CDOSYS? I have yet to recode all my existing uses of CDONTS over to CDOSYS. In most of the sample code I've seen on the usual ASP sites, there is...
16
3145
by: tshad | last post by:
I have both cdosys.dll and cdonts.dll on my W2K3 server. We have been told by our web authors that their asp code won't work on our machine and that we don't have CDONTS installed on our machine....
4
4110
by: Mac Davis | last post by:
Ive just learned that CDONTS is not available of Server 2003. So, I've been trying to make sense out of what I can read. I have succeeded in completely confusing myself. In one place Microsoft...
5
27679
by: MichaelK | last post by:
What do I need to do to enable CDONTS om my macine to make it working I'm testing the code: Dim objCDO Set objCDO = Server.CreateObject("CDONTS.NewMail") objCDO.To = "xyz@xxxxx.com"...
4
5030
by: Roger Withnell | last post by:
I'm sending Russian text in an email generated from the website which displays in the email as ?????????? The website is set to codepage 65001 and the charset to utf-8. Please advise. ...
12
6277
by: Jeff | last post by:
I have a dedicated windows server on BlueGenesis. I'd like to send an email using ASP, but I'm getting this error message: Microsoft VBScript runtime error '800a01ad' ActiveX component...
7
2869
by: Paul | last post by:
I have just started work on a system using CDONTS to mail out. Whilst this is fine on the server, my local development machine is using XP Pro with IIS5.1 installed. Is there a way I can get the...
6
2915
by: jbguernsey | last post by:
for: There was no reference to CDO in the References so selected CDO. Code didn't work (CDONTS.email unrecognised). read There was no reference to CDONTS in the References so selected CDO....
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7004
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7208
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4915
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4593
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1423
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.