Link to home
Start Free TrialLog in
Avatar of will77
will77

asked on

Server.CreateObject Failed - Invalid ProgID.


Please help as i am having this error
Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/will77/news/news/send_mail_function.inc, line 114

Invalid ProgID.

---------------------------------------------

This is the include page:send_mail_function.inc
<%
'Function to send an e-mail
Function SendMail(strEmailBody, strUserName, strUserEmail, strWebsiteName, strForumEmailAddress, strSubject, strMailComponent, blnHTML)

      'Dimension variables
      Dim objCDOSYSMail      'Holds the CDOSYS mail object
      Dim objCDOMail            'Holds the CDONTS mail object
      Dim objJMail            'Holds the Jmail object
      Dim objAspEmail            'Holds the Persits AspEmail email object
      Dim objAspMail            'Holds the Server Objects AspMail email object
      
      
      'Check the email body doesn't already have Web Wiz Forums
      If blnLCode = True AND Instr(strEmailBody, "Web Wiz Forums") = False Then
      
            'If HTML format then make an HTML link
            If blnHTML = True Then
                  strEmailBody = strEmailBody & "stem"
            'Else do a text link
            Else
                  strEmailBody = strEmailBody & VbCrLf & VbCrLf & "---------------------------------------------------------------------------------------"
                  strEmailBody = strEmailBody & VbCrLf & ""
                  strEmailBody = strEmailBody & VbCrLf & ""
            End If
      End If

      'Select which email component to use
      Select Case strMailComponent
      
            'CDOSYS mail component
            Case "CDOSYS"
                  
                  '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
                      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      
                        'Who the e-mail is from
                        .From = strWebsiteName & " <" & strForumEmailAddress & ">"
                                          
                        'Who the e-mail is sent to
                        .To = strUserName & " <" & strUserEmail & ">"
                                                      
                        'The subject of the e-mail
                        .Subject = strSubject
                                          
                        'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
                        If blnHTML = True Then
                               .HTMLBody = strEmailBody
                        Else
                              .TextBody = strEmailBody
                        End If
                                          
                        'Send the e-mail
                        If NOT strIncomingMailServer = "" Then .Send
                  End with                        
                                          
                  'Close the server mail object
                  Set objCDOSYSMail = Nothing
            
            'CDONTS mail component
            Case "CDONTS"
            
                  'Create the e-mail server object
                  Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
            
                  With objCDOMail
                        'Who the e-mail is from
                        .From = strWebsiteName & " <" & strForumEmailAddress & ">"
                                          
                        'Who the e-mail is sent to
                        .To = strUserName & " <" & strUserEmail & ">"
                                                      
                        'The subject of the e-mail
                        .Subject = strSubject
                                          
                        'The main body of the e-amil
                        .Body = strEmailBody
                                          
                        'Set the e-mail body format (0=HTML 1=Text)
                        If blnHTML = True Then
                              .BodyFormat = 0
                        Else
                              .BodyFormat = 1
                        End If
                        
                        'Set the mail format (0=MIME 1=Text)
                        .MailFormat = 0
                                          
                        'Importance of the e-mail (0=Low, 1=Normal, 2=High)
                        .Importance = 1
                                          
                        'Send the e-mail
                        .Send      
                  End With                  
                                          
                  'Close the server mail object
                  Set objCDOMail = Nothing
                              
            
            'JMail component
            Case "Jmail"
      
                  'Create the e-mail server object
                  Set objJMail = Server.CreateObject("JMail.SMTPMail")
                  
                  With objJMail
                        'Out going SMTP mail server address
                        .ServerAddress = strIncomingMailServer
                  
                        'Who the e-mail is from
                        .Sender = strForumEmailAddress
                        .SenderName = strWebsiteName
                                          
                        'Who the e-mail is sent to
                        .AddRecipient strUserEmail
                                                            
                        'The subject of the e-mail
                        .Subject = strSubject
                        
                        'Set the e-mail body format (BodyHTML=HTML Body=Text)
                        If blnHTML = True Then
                              .HTMLBody = strEmailBody
                        Else
                              .Body = strEmailBody
                        End If
                                          
                        'Importance of the e-mail
                        .Priority = 3
                                          
                        'Send the e-mail
                        If NOT strIncomingMailServer = "" Then .Execute      
                  End With                  
                                          
                  'Close the server mail object
                  Set objJMail = Nothing
      
      
            'AspEmail component
            Case "AspEmail"
      
                  'Create the e-mail server object
                  Set objAspEmail = Server.CreateObject("Persits.MailSender")
                  
                  With objAspEmail
                        'Out going SMTP mail server address
                        .Host = strIncomingMailServer
                              
                        'Who the e-mail is from
                        .From = strForumEmailAddress
                        .FromName = strWebsiteName
                              
                        'Who the e-mail is sent to
                        .AddAddress strUserEmail
                                                                              
                        'The subject of the e-mail
                        .Subject = strSubject
                        
                        'Set the e-mail body format (BodyHTML=HTML Body=Text)
                        If blnHTML = True Then
                              .IsHTML = True
                        End If
                        
                        'The main body of the e-mail
                        .Body = strEmailBody
                                                            
                        'Send the e-mail
                        If NOT strIncomingMailServer = "" Then .Send      
                  End With            
                                    
                  'Close the server mail object
                  Set objAspEmail = Nothing
                  
            'AspMail component
            Case "AspMail"
             
                     'Create the e-mail server object
                     Set objAspMail = Server.CreateObject("SMTPsvg.Mailer")
               
                     With objAspMail
                           'Out going SMTP mail server address
                           .RemoteHost = strIncomingMailServer
                      
                           'Who the e-mail is from
                           .FromAddress = strForumEmailAddress
                           .FromName = strWebsiteName
                      
                           'Who the e-mail is sent to
                           .AddRecipient " ", strUserEmail
                              
                           'The subject of the e-mail
                           .Subject = strSubject
                    
                           'Set the e-mail body format (BodyHTML=HTML Body=Text)
                           If blnHTML = True Then
                                  .ContentType = "text/HTML"
                           End If
                    
                           'The main body of the e-mail
                           .BodyText = strEmailBody
                          
                           'Send the e-mail
                           If NOT strIncomingMailServer = "" Then .SendMail
                     End With  
                 
                     'Close the server mail object
                     Set objAspMail = Nothing
      End Select      
      
      'Set the returned value of the function to true
      SendMail = True
End Function
%>

-------------------------------
Thank you
ASKER CERTIFIED SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of whammy
whammy

I would agree... are you hosting this site yourself, or are you using another host?

I received _exactly_ the same message a long, long time ago when I first started using brinkster.com as a host for one of my sites, and tried to send a CDONTS email:


Server.CreateObject Failed

... insert page here ...

Invalid ProgID.


brinkster.com doesn't register the CDONTS .dll (if I understand their policy) on the "free" servers, so fritz is most likely correct. ;-)
Most hosting companies do support at least one mailing script, so you just need to find out what it is and then code for that.

Fritz the Blank
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by fritz_the_blank

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer