Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Server.CreateObject Failed  - Invalid ProgID.

Posted on 2003-03-08
4
Medium Priority
?
751 Views
Last Modified: 2008-02-01

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
0
Comment
Question by:will77
  • 2
4 Comments
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 80 total points
ID: 8096513
It is difficult to say for certain, but it looks like your code is trying to send mail with a component that is not registered or is not configured properly.

Fritz the Blank
0
 
LVL 4

Expert Comment

by:whammy
ID: 8100113
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. ;-)
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8103509
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
0
 
LVL 58

Expert Comment

by:Gary
ID: 9353003
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
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question