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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing with IIS

Status
Not open for further replies.

porto99

Technical User
Nov 1, 2004
96
GB
I have just installed IIS on my old PC (running Windows 2000). This is to test my Web Site before getting onto the real server.

I am using asp to handle the Contact page where users can e-mail me.

I have been using JMail in a Send_email.asp, but get the error:-

Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: /My_Site/send_email.asp, line 108

Now line 108 is shown below:-

<b>Set objJMail = Server.CreateObject("JMail.SMTPMail")</b>

Have I configured the IIS program corectly.

Note this PC is on my home network (shares internet via a gateway PC) and the only e-mail I have on it is my hotmail.

i.e. what do I put in these fields:-

strMyEmailAddress = "myhotmail@hotmail.com"

'---------- Place the address of the SMTP server you are using in the following sting ---------------

strSMTPServerAddress = "smtp.hotmail.com"

Is the above the problem or something else. But I would like to see my hotmail being used to output the contact info. This is for testing only.

I assume that when on the real server I will need to use my ISP e-mail?

Cheers,

Porto.
 
The line 108 is attempting to create an instance of a COM object named JMail.SMTPMail.

Do you have this object installed on your machine?


You can test by copying the code below into a plain text file and saving it on your destop as TestObject.VBS

Then just double-click the file icon and it will run and tell you if the object is installed and properly registered.
Code:
On Error Resume Next
Set ob = CreateObject("JMail.SMTPMail")
If Not ob Is Nothing Then
  MsgBox "object created OK"
  Set ob = Nothing
Else
  MsgBox "failed to create object"
End IF

If it is installed but not registered, you can register it with RegSvr32.exe.

If it is installed and registered but you still can't use it in the web page, make sure that your IUSR_MachineName account has privilages to the library.
 
Sheco thanks for the post.

I ran your test program and it worked OK.

Just need a little more help with regard to <b>IUSR_MachineName that you stated.</b>

Many thanks,

porto.
 
IUSR_MachineName is the defualt account that IIS uses for web visitors... where MachineName is the name of your server.

By default this account only has permissions to the subfolders in your \inetpub directory. The logic behind this is that even if a web user manages to maliciously "take over" the session via hacking, there will be a limit to the damage they are able to do to the rest of the system.

So, if your web server's permissions are still set to their default settings, it is possible that the reason the ASP can't create the object is that the account it is using doesn't have permission to do so.

Since the error message you report is Invalid ProgID I would expect this to be a problem with registering (installing) the jmail.dll rather than with permissions but there is a way to test this as well... first find the jmail.dll on the computer... according to page 5 of the manual at the default install path is C:\Program Files\Dimac\w3JMail4\

... find that file and right-click it to look at the security properties. Does your IUSR_MachineName account have permissions?

If not you can do another test by making 2 copies of a simple ASP script that creates the object:
Code:
<%
Response.Write "Current Error = " & err.Number & " <br>"
Response.Write "About to create object...  <br>"
On Error Resume Next
Set ob = Server.CreateObject("JMail.SMTPMail")

IF ob Is Nothing THEN
  Response.Write "CreateObject failed. <br>"
ELSE
  Response.Write "object created. <br>"
END IF

Response.Write "Current Error = " & err.Number & " <br>"
%>

So, like I was saying make 2 copies of a simple script like this... Then use the IIS Admin tool to go in and change the security profile on one of them to use your local admin account and leave the other with the default permissions... Now use your borwser to open both of them and see what you get. If it works as local admin but not with the default permissions then you've found the problem and all you need to do is grant permission to the IUSR so it can use jmail.dll
 
Thanks again for your post.

I did search for JMail.dll and it was NOT on my computer.

I have now downloaded and installed it.

BUT now get new error:-


Error Type:
jmail.SMTPMail (0x8000FFFF)
The message was undeliverable. All servers failed to receive the message
/My_Site/send_email.asp, line 143


and line 143 it the Execute:- (see below)

'Send the e-mail
objJMail.Execute

Have I downloaded the correct ite?

w3Jmail at

Note I have regestered the JMail.dll OK.

Any suggestions,

porto
 
It sounds like you're having a problem with your SMTP server. Check that you're using the correct SMTP address.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Sheco, I wrote a VB.Net program with the code I was using in the script and got the following error when running the program:-

<b>An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in microsoft.visualbasic.dll

Additional information: The message was undeliverable. All servers failed to receive the message</b>

I dont think I know what to do in IIS or Personal Web Manager.

Can you help,

Many thanks,

porto.
 
Well that is certainly a step in a positive direction because now your script is able to create an instance of the object.

I agree with Tracy's reading of the error message... it sounds like the jmail object is reporting that the mail server is not accepting the outgoing message.

Going back to the manual that I linked above, on page 8 we see:
Code:
[b]Sending e-mails with Dimac w3 JMail[/b]

The example below shows how to get up and running with Dimac’s w3 JMail.
You will be shown how to create an e-mail by specifying the subject and body
and how to send it.

First of all we need to create an instance of the jmail.message object:
[blue]set msg = Server.CreateOBject("JMail.Message")[/blue]

Now lets turn on logging to make any debugging easier:
[blue]msg.Logging = true[/blue]

We need to provide a sender as well as a recipient:
[blue]msg.From = "john.doe@mydomain.com"
msg.FromName = "John Doe"
msg.AddRecipient "lisa.simpson@springfi eld.com"[/blue]

The addRecipient method can be used multiple times to add more than one
recipient. Also, it can take an optional parameter which specifi es the name of
the recipient:
[blue]
msg.AddRecipient "deliveryboy@futurama.com", "Fry"
msg.AddRecipient "theblob@southpark.com", "Cartman"[/blue]

Ok, now we should add a subject:
[blue]msg.Subject = "How are you?"[/blue]

and a body. The example below also shows how to add carriage returns:
[blue]msg.Body = "This w3 JMail stuff rocks!" & vbCrLf[/blue]

Another way to create the body of the e-mail is to use the appendText
method, which can be used multiple times to build the e-mail body:
[blue]msg.appendText "Here’s some text."
msg.appendText "And here’ s some more"[/blue]

There you go, the e-mail message is complete, now all we need is to send it.
To do that we need to enter the address of a valid mail server which accepts
incoming e-mails from your web server:
[highlight][blue]msg.Send("mail.myDomain.com")[/blue][/highlight]

That’s it! Once you have acquainted yourself with the basics of w3 JMail, you
can find more elaborate examples at our site [URL unfurl="true"]http://www.dimac.net/[/URL]

I highlighted the part the mail server is specified and I notice that it uses a procedure named .Send instead of .Execute. Is it possible that I am not looking at the manual for the version that you are using? The one I'm looking at is for w3 JMail 4.3.1.
 
Thanks for the posts (both Sheco and Tracy)

I will try tonight when get home from work.

The only problem I see is the mail server?

This test PC has only my hotmail and a shared internet connection via my main PC (Gateway on the home network).

So can I use 'mail.hotmail.uk.co' or 'mail.hotmail.com' or just 'localhost' for the mail server?

Or can I specify the mail server of the Gateway PC, boy am I confused!?!

Any comments please.

Porto.
 
You need the address of an email server that talks SMTP and will allow you to relay messages. I'm not sure if hotmail will accept plain SMTP these days...
 
Thanks again for your post.

I did set the mail.server to "" and no error messages and no e-mails sent.

It looked as if it worked!

I can only assume that when I load up the site to the real server then using that servers mail.server all will work!

As an alternative I could look for a different implementation, but may come back to the same problem; i.e. no mail.server on the PC.

Thanks again,

Porto.
 
IIS has an SMTP-only mail service... it is kinda like half of a mail server... it can do SMTP but not POP3 so send but not receive.
 
Thanks, I found that if I set objJMail.ServerAddress = "" then it sends mail to the specified address.


[2thumbsup]Porto.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top