Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > how can i change CDONTS values to CDOSYS?

Reply
Thread Tools

how can i change CDONTS values to CDOSYS?

 
 
beyaz
Guest
Posts: n/a
 
      03-22-2008
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 = "(E-Mail Removed)"
form_to = "(E-Mail Removed)"
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("")
%>

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      03-22-2008
"beyaz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 = "(E-Mail Removed)"
> form_to = "(E-Mail Removed)"
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
A Paradise DNS address change? What change? There was no change. Tony Neville NZ Computing 7 09-22-2006 01:02 PM
Can you persist table cell values like you can do with form field values? Richard Dixson ASP .Net 1 05-18-2004 03:47 AM
ActiveX component can't create object: 'CDONTS.NewMail' aa ASP General 1 05-13-2004 05:16 PM
Where i can find a Cdonts email component ivan divandelen ASP General 0 09-02-2003 07:59 AM



Advertisments