Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

from cdonts to cdosys 2

Status
Not open for further replies.

lizzi

Technical User
Feb 12, 2004
45
SE
Hi

I´ve got this form that has worked perfect with CDONTS, but now when I must use CDOSYS I get this error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

This is my form:

Code:
subject	="EM LOTTEN"			

sender = "webmaster@herremlotten.nu"

body = body & "HERR-EM LOTTEN: " & vbCRLF _
& vbCRLF _
& "Antal: " &vbTAB &antal &vbCRLF _
& "Distrikt:" &vbTAB &distrikt  &vbCRLF _
& "Förening: " &vbTAB & club &vbCRLF _
& "Leveransadress:" &vbTAB &address &vbCRLF _
& "Postnr/Ort:" &vbTAB &vbTAB &vbTAB &vbTAB & zipcode &vbCRLF _
& "Kontaktman:" &vbTAB &vbTAB &vbTAB &vbTAB & contact &vbCRLF _
& vbCRLF _
& "E-post: " &vbTAB &vbTAB &vbTAB & mail & vbCRLF _
& "Tel.förening:" &vbTAB & cphone & vbCRLF _
& "Tel.bostad:" &vbTAB &vbTAB & hphone & vbCRLF _

' ## ...SEND ORDER 
Set CDOMail 	 = Server.CreateObject("CDO.Message")
CDOMail.From 	= sender
CDOMail.To 	= "info@ewd.se"
CDOMail.Subject = subject
CDOMail.HTMLBody = body
CDOMail.Send
Set CDOMail = Nothing

Could someone please say whats´s wrong, the host just say use CDOSYS and nothing more!

/Lizzi
 
Maybe this is working :
Code:
subject    ="EM LOTTEN"            

sender = "webmaster@herremlotten.nu"

body = body & "HERR-EM LOTTEN: " & vbCRLF _
& vbCRLF _
& "Antal: " &vbTAB &antal &vbCRLF _
& "Distrikt:" &vbTAB &distrikt  &vbCRLF _
& "Förening: " &vbTAB & club &vbCRLF _
& "Leveransadress:" &vbTAB &address &vbCRLF _
& "Postnr/Ort:" &vbTAB &vbTAB &vbTAB &vbTAB & zipcode &vbCRLF _
& "Kontaktman:" &vbTAB &vbTAB &vbTAB &vbTAB & contact &vbCRLF _
& vbCRLF _
& "E-post: " &vbTAB &vbTAB &vbTAB & mail & vbCRLF _
& "Tel.förening:" &vbTAB & cphone & vbCRLF _
& "Tel.bostad:" &vbTAB &vbTAB & hphone & vbCRLF _

' ## ...SEND ORDER 
Dim objCDOSYSCon
Dim objCDOSYSMail
Dim strOutgoingMailServer

'define the adres of your mailserver
strOutgoingMailServer = "10.0.0.150"

Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Set and update fields properties
With objCDOSYSCon
	'Out going SMTP server
	.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = strOutgoingMailServer
	'SMTP port
	.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL]  = 25
	'CDO Port
	.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
	'Timeout
	.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 60
	.Fields.Update
End With

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon

With objCDOSYSMail

.From = sender
.To = "info@ewd.se"
.Subject = subject
'uncomment below if you want to send your mail in HTML
'.HTMLBody = body

'comment out below if you want to send your mail in HTML
'it is now sended as plain-text
.TextBody = body
.Send

End with

Set objCDOSYSMail = Nothing
Do not forget to set te adres of your email server
 
Thanks, but I don´t now any email server. Do I really need that? They just keep on saying use CDOSYS...
 
You can also use the smtp of your own server as long the service is enabled and configured. But what is the reason that you can't use CDONTS anymore?
 
Here is the sample CDOSYS code:

Code:
<%
'Dimension variables
Dim objCDOSYSCon
'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Set and update fields properties 
'Out going SMTP server 
objCDOSYSCon.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "mail.yourservername.LOCAL" 
'SMTP port 
objCDOSYSCon.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL]  = 25 
'CDO Port 
objCDOSYSCon.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2 
'Timeout 
objCDOSYSCon.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 60 
objCDOSYSCon.Fields.Update 

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
'Who the e-mail is from 
objCDOSYSMail.From = "xxxx@yourservername.com" 
'Who the e-mail is sent to 
objCDOSYSMail.To = "xyyyy@ssss.com" 
'The subject of the e-mail
objCDOSYSMail.Subject = "Testing" 
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain) 
'objCDOSYSMail.HTMLBody = "Hello" 
objCDOSYSMail.TextBody = Request.Form.Item("valmessage")
'Send the e-mail 
objCDOSYSMail.Send 
Response.Write "Your email has been sent."
'Close the server mail object 
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
%>

-L
 
Sorry Lothario.. but this is the same as i was sending.
His problem is that he don't know wich server to use for sending the mail. !!!!!! Maybe reading the entire discussion before sending something helps.

Sorry
 
CDO(NTS) is no longer available on Win 2k3 Server and up. You must use CDO on newer Windows servers. Both were/are available on Win2K Servers.

Wow JT that almost looked like you knew what you were doing!
 
Thanks alot I´ve now the smtp server and I get the mail. But I´think there must be some trouble with:

Code:
body = body & "HERR-EM LOTTEN: " & vbCRLF _
& vbCRLF _
& "Antal: " &vbTAB &antal &vbCRLF _
& "Distrikt:" &vbTAB &distrikt  &vbCRLF _
& "Förening: " &vbTAB & club &vbCRLF _
& "Leveransadress:" &vbTAB &address &vbCRLF _
& "Postnr/Ort:" &vbTAB &vbTAB &vbTAB &vbTAB & zipcode &vbCRLF _
& "Kontaktman:" &vbTAB &vbTAB &vbTAB &vbTAB & contact &vbCRLF _
& vbCRLF _
& "E-post: " &vbTAB &vbTAB &vbTAB & mail & vbCRLF _
& "Tel.förening:" &vbTAB & cphone & vbCRLF _
& "Tel.bostad:" &vbTAB &vbTAB & hphone & vbCRLF _

.TextBody = body

Now I don´t get the values from the form. What could it be?
 
Finially a great example of exactly what I needed thanks
Lothario. Stars to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top