Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Sending an email and to a database at the same time
Old 07-14-2004, 07:09 AM Sending an email and to a database at the same time
Experienced Talker

Posts: 37
Trades: 0
im attempting to send some form details to both an access database and to an email address at the same time.

Ive got the form results going to the database fine and this is all up and running.

However i cannot for the life of me get the form results sent to my email!!! Ive got this code which i dont think is too far from been right - but which areas are wrong??

Help please!!!

Code:
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)            = "http://217.180.78.26/exchange/"	
	.Item(cdoSMTPServerPort)        = "25"
	.Item(cdoSMTPConnectionTimeout) = "10"
	.Item(cdoSMTPAuthenticate)      = "cdoBasic"
	.Item(cdoSendUserName)          = "<Myusername>"
	.Item(cdoSendPassword)          = "<Mypassword>"
	
	.Update
	
End With

Set objMessage.Configuration = objConfig

With objMessage
	.To			= "pworsnop@wickersley.net"
	.From		= "Sender's Email"
	.Subject	= "Absence Request"
	
	.TextBody	= "This is the message"
        'or
	'.HTMLBody	= "<This is the message in HTML>"
	
	On Error Resume Next
	
	.Send
	
	If err.number = 0 Then
		flgEmailSent = True
	Else
		m_strErrors = err.Description
	End If 
	
	On Error GoTo 0
End With

Set objMessage = Nothing
Set objConfig = Nothing		

%>
When i use the above code in the confirmation .asp page it brings up the following error:

Code:
ADODB.Fields error '800a0ea5' 

Fields update failed. For further information, examine the Status property of individual field objects. 

/AbsenceForm/RecordAdded.asp, line 86
woody22 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Sending an email and to a database at the same time
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 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.07848 seconds with 12 queries