I have the base of the system working and would like to try the email portion.
When trying to send test email from Admin portal I was receiving the following error located here
http://www.liberum.org/forums/p/28/50.aspx
I made the change as described in the second post and am now receiving a new error.
Please let me know if anyone else has encountered this error.
Thanks
Have you tryed using CDOSYS? That's what ended up resolving our issues.
This is the code for CDOSYS that I have been using:
START CODE
Select Case Cfg(cnnDB, "EmailType") Case 0 'No Email
Case 1 'CDONTS Set Mail = Server.CreateObject("CDONTS.NewMail") Mail.BodyFormat = 1 ' Text Only, 0 for HTML Mail.Subject = strSubject Mail.To = strToAddr Mail.Body = strBody Mail.Send(Cfg(cnnDB, "HDName") & "<" & Cfg(cnnDB, "HDReply") & ">") Set Mail = Nothing
Case 2 'Jmail On Error Resume Next ' Use Jmail logging Set Mail = Server.CreateObject("Jmail.Message") Mail.Logging = True Mail.From = Cfg(cnnDB, "HDReply") Mail.FromName = Cfg(cnnDB, "HDName") Mail.AddRecipient strToAddr Mail.Subject = strSubject Mail.Body = strBody If Not Mail.Send(Cfg(cnnDB, "SMTPServer")) Then If Application("Debug") Then Call DisplayError(3, Mail.Log) End If End If Set Mail = Nothing
Case 3 'ASPEmail Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = Cfg(cnnDB, "SMTPServer") Mail.From = Cfg(cnnDB, "HDReply") Mail.FromName = Cfg(cnnDB, "HDName") Mail.AddAddress strToAddr Mail.Subject = strSubject Mail.Body = strBody Mail.Send Set Mail = Nothing
Case 4 ' ASPMail Set Mail = Server.CreateObject("SMTPsvg.Mailer") Mail.FromName = Cfg(cnnDB, "HDName") Mail.FromAddress = Cfg(cnnDB, "HDReply") Mail.RemoteHost = Cfg(cnnDB, "SMTPServer") Mail.AddRecipient "Help Desk User", strToAddr Mail.Subject = strSubject Mail.BodyText = strBody Mail.SendMailCase 5 ' CDOSYS DIM strIncomingMailServer, objCDOSYSMail, objCDOSYSCon 'Create the e-mail server object strIncomingMailServer = Cfg(cnnDB, "SMTPServer") Set objCDOSYSMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Set and update fields properties With objCDOSYSCon
'Out going SMTP server .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strIncomingMailServer 'SMTP port .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'CDO Port .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Timeout .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 .Fields.Update End With
'Update the CDOSYS Configuration Set objCDOSYSMail.Configuration = objCDOSYSCon
With objCDOSYSMail .From = Cfg(cnnDB, "HDName") & " <" & Cfg(cnnDB, "HDReply") & ">" .To = strToAddr .Subject = strSubject '.HTMLBody = strBody 'Set the e-mail body format (HTMLBody=HTML TextBody=Plain) .TextBody = strBody 'Send the e-mail If NOT strIncomingMailServer = "" Then .Send End with
'Close the server mail object Set objCDOSYSMail = Nothing
End Select
END CODE
Here is the code from Public.asp that we use for email.
____________________________________________________________
________________________________________________________________
3rd time I have tried to replay:
Code from Public.ASP for CDOSYS:
Thanks kingvandal for the quick reply.
I Tried changing to
'CDONTS Set Mail = Server.CreateObject("CDOSYS.NewMail")
Same error was displayed!
We are using exchange 2003, are you using the same? If so do you mind showing me the snippet of code that is working for you?
I have set all the settings back to normal unregistered cdonts.dll and registered again and no more error!
Now to find out where my test email went lol.
Very good. Sorry I tryed 3 different times to opst working CDOSYS code but the board would not allow me to post it. Grrr...
Do these forums support BB Code?
Enter your code here
Yep, the boards support the BB Code.
http://en.wikipedia.org/wiki/BBCode
Look at the code section to see how to post code in a bulletin board.
[ CODE .]
[/ CODE .]
Ok, here is what I did to make it work, Thanks to bits and pieces from everyone. I hope this helps someone else.
This is a link to a document that was a huge help and could help for different scenarios
http://www.pa-software.com/documentation/Scripts/Send_mail_with_CDO.rtf
Scenario: Windows 2003 Server, SQL 2008, no Exchange Server - email is outsourced.
First, set the email option in the HelpDesk site config to CDONTS
Go to the site files and open public.asp in notepad or whatever editor you choose. Search for 'Sub SendMail'. This is the function that sends the mail. Replace the code in the CASE 1 statement. You may have to tweak it for your situation but here is what worked for me and my outside SMTP server. The first Config line (sendusing) with a value of 2 indicates you are using and outside SMTP server, not the local machine. The third line (smtpauthenticate), value 1 is basic authentication, meaning supply a user account and password. My mail provider requires full email address as username, but yours may not. Then set your port and set SSL True or False depending on your system.
Case 1 'CDONTS Set Mail = Server.CreateObject("CDO.Message") Mail.Subject = strSubject Mail.To = strToAddr Mail.From = Cfg(cnnDB, "HDReply") Mail.TextBody = strBody
Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="mail.mycompany.com" Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1 Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")="helpmail@mycompany.com" Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")="mypassword" Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl")=False Mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")=60 Mail.Configuration.Fields.Update Mail.Send Set Mail = Nothing
Good luck.