Hi all,
Hope I will get correct solution from this group
I have created a dll to read the mails from inbox folder and to send the mail-using outlook.
This is my dll code
Public Function sendMail()
Dim objOutlook As New Outlook.Application
Set objOutlook = CreateObject("Outlook.Application")
Dim objNamespace As Outlook.NameSpace
Set objNamespace = objOutlook.GetNamespace("MAPI")
Dim objInbox As Outlook.mapiFolder
'Set objInbox = CreateObject("Outlook.MAPIFolder")
Set objInbox = objNamespace.GetDefaultFolder(olFolderInbox)
Dim objItems As Outlook.Items
Set objItems = objInbox.Items
Dim oMsg As Outlook.MailItem
Dim i As Integer
For i = 1 To 5
'Set oMsg = objItems.Item(i)
'MsgBox ("Message number: " & i)
'MsgBox ("From : " & oMsg.Subject)
'MsgBox ("To : " & oMsg.Recipients)
Next i
'objInbox = objNamespace.GetDefaultFolder (Outlook.OlDefaultFolders.olFolderInbox)
Set MailItem = objOutlook.CreateItem(0)
With MailItem
.Subject = "Test mail from
VB"
.To = "
[email protected]"
.Send
End With
End Function
My ASP code like
<%
set mailTestDll = server.CreateObject("Project1.class1")
mailTestDll.sendMail()
Response.Write("Success")
%>
If I access this code from localhost (
http://localhost/inboxread.asp), mails are sending successfully. But if I access this page from another machine (
http://pcnumber/inboxread.asp) I am getting the following error
Error Type:
Project1 (0x800A0046)
Permission denied
inboxTest.asp, line 3
Please advise me
Regards,
Arunachalam.S