Reply
CDONTS not working - Please help
Old 08-09-2004, 09:47 AM CDONTS not working - Please help
Junior Talker

Posts: 1
Location: Lexington, Mass
I am not getting any errors at all, just not receiving the EMAIL.

SEE below
Emailform.asp
Scripts.asp
Submitform.asp
Submitdone.htm
*************************
<%@ Language=VBScript %>

<HTML>
<HEAD>
<TITLE></TITLE>
<!--#include file="scripts.asp"-->

</HEAD>
<BODY>
<H2><FONT COLOR="#336699">Email Form</FONT></H2> <FORM ACTION="submitform.asp" Method="Post" >
<INPUT TYPE="hidden" NAME="FormName" VALUE="emailform.asp">
<INPUT TYPE="hidden" NAME="subject" VALUE="Email Form Sample">
<INPUT TYPE="hidden" NAME="SendTo" VALUE="kklimarchuk@supremecouncil.org">
<TABLE WIDTH="274" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD COLSPAN="2" ALIGN="CENTER" WIDTH="274"></TD>
</TR>
<TR>
<TD WIDTH="88">Name:</TD>
<TD WIDTH="186"><INPUT TYPE="TEXT" NAME="txtName" <%Call RequestInfo("txtName", "")%>></TD>
</TR>
<TR>
<TD WIDTH="88">Address:</TD>
<TD WIDTH="186"><INPUT TYPE="TEXT" NAME="txtAddress" <%Call RequestInfo("txtAddress", "")%>></TD>
</TR>
<TR>
<TD WIDTH="88">Phone:</TD>
<TD WIDTH="186"><INPUT TYPE="TEXT" NAME="txtPhone" <%Call RequestInfo("txtPhone", "")%>></TD>
</TR>
<TR>
<TD WIDTH="88">Email:</TD>
<TD WIDTH="186"><INPUT TYPE="TEXT" NAME="txtEmail" <%Call RequestInfo("txtEmail", "")%>></TD>
</TR>
<TR>
<TD WIDTH="88">Gender:</TD>
<TD WIDTH="186"><INPUT TYPE="RADIO" NAME="radGender" VALUE="m"
<%Call RequestInfo("radGender", "m")%>>Male&nbsp;<INPUT TYPE="RADIO" NAME="radGender"
VALUE="f" <%Call RequestInfo("radGender", "f")%>>Female</TD>
</TR>
<TR>
</TR>
<TR>
<TD COLSPAN="2" WIDTH="274"><BR><B>Check all that apply:</B></TD>
</TR>
<TR>
<TD COLSPAN="2">&nbsp;&nbsp;<INPUT TYPE="CHECKBOX" NAME="chkVB" <%Call RequestInfo("chkVB", "on")%>>
Visual Basic<BR>&nbsp;&nbsp;<INPUT TYPE="CHECKBOX" NAME="chkASP" <%Call RequestInfo("chkASP", "on")%>> ASP<BR>
&nbsp;&nbsp;<INPUT TYPE="CHECKBOX" NAME="chkJava" <%Call RequestInfo("chkJava", "on")%>> Java<BR>&nbsp;&nbsp;<INPUT
TYPE="CHECKBOX" NAME="chkOther" <%Call RequestInfo("chkOther", "on")%>> Other&nbsp;<INPUT TYPE="TEXT"
NAME="txtOther" <%Call RequestInfo("txtOther", "")%>><BR><BR></TD>
</TR>
<TR>
<TD COLSPAN="2" WIDTH="274" ALIGN="RIGHT"><INPUT TYPE="SUBMIT"
NAME="Submit" VALUE="Send Now!"></TD>
</TR>
</TABLE></FORM> </BODY>
</HTML>
*
<%
sub RequestInfo(objName, btnVal)
Select Case left(objName,3)
Case "rad", "chk"
if Request(objName)=btnVal then
Response.Write("checked")
end if
Case "sel"
if Request(objName)=btnVal then
Response.Write("selected")
end if
Case "txt"
Response.Write "Value='" & Request(objName) & "'"
End Select
end sub
%>
************************************************** ***
<%


'change this to the appropriate http
Const strHTTP = "http://test3/valleyforms/"

'get current date
strDate = Date()

'get form information
strFormName = Request("FormName")
strSubject = Request("subject")
strSendTo = Request("SendTo")

strName = Request("txtName")
strPhone = Request("txtPhone")

'if no information entered for email use your own
if instr(Request("txtEmail"), "@") <> 0 then
strFrom = Request("txtEmail")
else
strFrom = strSendTo
end if

'concat URL information
strURLInfo = strHTTP & strFormName & "?" & Request.Form()

'create the HTML for email
strHTML = "<HTML> <HEAD> <TITLE></TITLE> </HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<TABLE WIDTH=500 CELLPADDING=0 CELLSPACING=0>"
strHTML = strHTML & "<TR>"

'use some graphics for email
strHTML = strHTML & "<TD><IMG SRC=" & strHTTP & "emailbanner.JPG BORDER=0></TD>"
strHTML = strHTML & "</TR>"

'include basic info in email
strHTML = strHTML & "<TR>"
strHTML = strHTML & "<TD>"
strHTML = strHTML & "<BR>Date: " & strDate
strHTML = strHTML & "<BR>Subject: " & strSubject
strHTML = strHTML & "<BR>Requested by: " & strName
strHTML = strHTML & "<BR>Phone: " & strPhone

if strFrom <> strSendTo then
strHTML = strHTML & "<BR>Email: <a href=mailto:" & strFrom & ">" & strFrom & "</a>"
else
strHTML = strHTML & "<BR>Email: UNKNOWN"
end if

'add hyperlink to form in email
strHTML = strHTML & "<BR><BR>"
strHTML = strHTML & "<A HREF=" & strURLInfo & "><IMG SRC=" & strHTTP & "form.gif WIDTH=16 HEIGHT=16 BORDER=0>Click here</A>"
strHTML = strHTML & " to view completed form."
strHTML = strHTML & "</TD>"
strHTML = strHTML & "</TR>"
strHTML = strHTML & "<TR>"
strHTML = strHTML & "<TD></TD>"
strHTML = strHTML & "</TR>"
strHTML = strHTML & "</TABLE>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"


'time to send the email
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")

objCDO.To = strSendTo
objCDO.From = strFrom
objCDO.Subject = strName & " - " & strSubject
objCDO.BodyFormat = 0
objCDO.MailFormat = 0
objCDO.Body = strHTML
objCDO.Send

set objCDO = nothing

'redirect to the "Thanks" page
Response.Redirect strHTTP & "submitdone.htm"
%>
*************HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<TABLE WIDTH="509" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD WIDTH="509" HEIGHT="91" ALIGN="CENTER">
<H2><FONT COLOR="#336699">Transmission Successful</FONT></H2>
<P><FONT COLOR="#6600FF">We will review the information you provided
and will get back to you to complete the process.</FONT></P></TD>
</TR>
<TR>
<TD WIDTH="509" ALIGN="CENTER"><BR><B>Me<BR>1600 My Ave
North<BR>Anywhere, USA</B><BR><BR><B>Phone: 800-111-1111 </B><BR> </TD>
</TR>
<TR VALIGN="MIDDLE">
<TD WIDTH="509" ALIGN="CENTER" VALIGN="MIDDLE" HEIGHT="40"><A
HREF="mailto:kklimarchuk@supremecouncil.org"><IMG SRC="email1.gif" WIDTH="30" HEIGHT="28"
BORDER="0" ALIGN="MIDDLE">me@address.com</A></TD>
</TR>
</TABLE> </BODY>
</HTML>
*************************************
NEED HELP BAD
Maximus2004 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 08-11-2004, 06:45 PM
Skilled Talker

Posts: 63
does CDONTS use a default email server? you might need to define it somehow, somewhere.
antoshka is offline
Reply With Quote
View Public Profile Visit antoshka's homepage!
 
Old 08-13-2004, 08:42 AM
ACW
Average Talker

Posts: 26
I've encountered similar problems with CDONTS. CDONTS will not return an error in many circumstances although the email did not actually go out. There are ways to try to find out whether the emails are being queued or bad in some way by viewing the sever logs and the bad mail folder - but you probably don't have this kind of access to the server.

I suggest you use CDOSYS instead of CDONTS. Here is some code that helps you do it.

The following code creates an email object which you can later move to an include page and reuse it throughout the site. Using an object will also allow you to change the email component without having to change all the pages that email. You just change the MyEmail class.

Code:
Class MyEmail
 Private m_strMailServer
 Private m_strUserName
 Private m_strPassword
 
 Public Property Let MailServer(value)
  m_strMailServer = value
 End Property
 
 Public Property Let UserName(value)
  m_strUserName = value
 End Property
 
 Public Property Let Password(value)
  m_strPassword = value
 End Property
 
 Public Function SendEmail(ToEmail, FromEmail, Subject, Body)
  Dim objConfig  ' As CDO.Configuration
  Dim objMessage ' As CDO.Message
  Dim flgEmailSent

  flgEmailSent = False

  Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
  Const cdoSendUsingPort = 2
  Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
  Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
  Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
  Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
  Const cdoBasic = 1
  Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"
  Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"

  Set objConfig = CreateObject("CDO.Configuration")
  Set objMessage = CreateObject("CDO.Message")

  ' Set config fields we care about
  With objConfig.Fields
   .Item(cdoSendUsingMethod)       = cdoSendUsingPort
   .Item(cdoSMTPServer)            = m_strMailServer 'Your mail server
   .Item(cdoSMTPServerPort)        = 25
   .Item(cdoSMTPConnectionTimeout) = 10
   .Item(cdoSMTPAuthenticate)      = cdoBasic
   .Item(cdoSendUserName)          = m_strUserName 'UserName - usually full email
   .Item(cdoSendPassword)          = m_strPassword 'Password
   
   .Update
  End With

  Set objMessage.Configuration = objConfig

  With objMessage
   .To   = ToEmail
   .From  = FromEmail
   .Subject = Subject
   
   .TextBody = Body
    'or
   '.HTMLBody = "<b>This is the message in HTML</b>"
   
   On Error Resume Next
   
   .Send
   
   flgEmailSent = (err.number = 0)
   
   On Error GoTo 0
  End With

  Set objMessage = Nothing
  Set objConfig = Nothing
  
  SendEmail = flgEmailSent
 End Function
End Class
The following code is an example of how to use the object.

Code:
Dim objNewEmail

Set objNewEmail = New MyEmail

objNewEmail.MailServer = "mail.myycompany.com"
objNewEmail.UserName = "myemail@myycompany.com"
objNewEmail.Password = "myemailpassword"

objNewEmail.SendEmail "to_email@mycompany.com", "from_email@mycompany.com", "subject", "body"

Set objNewEmail = Nothing
I hope this helps.
__________________
Affordable Business Web Site Hosting by Geo Redundant Hosting
ACW is offline
Reply With Quote
View Public Profile
 
Old 08-26-2004, 11:48 AM
melfan's Avatar
Skilled Talker

Posts: 90
Do you manage your own hosting?? It is possible that the problem relies on the server itself. If your mail server is not configured properly all CDONT code wont return error simply becase the sending is successful but it is qued on the mail server until it is triggered to do so.
melfan is offline
Reply With Quote
View Public Profile Visit melfan's homepage!
 
Reply     « Reply to CDONTS not working - Please help
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14281 seconds with 12 queries