Hi Hope you can help
I have two programs one that works both on NT server and winXP and one that works only on WINXP. One uses CDO to read mail and save the attachment the other tries to send an email. The program that sends the e-mail keeps comming up with an error "E_ACCESSDENIED" where as the other program works fine. Does Anyone have any ideas?
Here is the important part of the code for both applications
Appliation 1 (Sends e-mail) Works on winXP but not NT Server
Dim oSession As New MAPI.Session
Dim oMessage1 As MAPI.Messages
Dim oMessage As MAPI.Message
oSession.Logon "MS Exchange Settings"
Set objFolder = oSession.Outbox
Set oMessage1 = objFolder.Messages
Set oMessage = oMessage1.Add
oMessage.Recipients.Add <name>, <e-mail address>
oMessage.Text = "Hello"
oMessage.Send
oSession.Logoff
Set oSession = Nothing
Appliation 2 (Reads e-mail and saves attachment) Works on winXP and NT Server
Dim osession As New mapi.Session
Dim mess As mapi.Messages
Dim objCurrentMsg As mapi.Message
Dim objFolder As mapi.Folder
Dim Folders1 As mapi.Folders
Dim atach As mapi.Attachment
Dim atachs As mapi.Attachments
osession.Logon "MS Exchange Settings"
Set objFolder = osession.GetDefaultFolder(1)
Set mess = objFolder.Messages
Set objCurrentMsg = mess.GetFirst
For i = 0 To mess.Count - 1
If UCase(objCurrentMsg.Subject) = <Subject> Then
Set atachs = objCurrentMsg.Attachments
Set atach = atachs.Item(1)
atach.WriteToFile (<PATH> & atach.Name)
End if
objCurrentMsg.Delete True
Next
Set objCurrentMsg = mess.GetNext
Next
osession.Logoff
The send e-mail program was working before i installed the second program. Also both programs use the CDO 1.21 libary.
I have been struggling with this for days so any help would be very usefull.
I have two programs one that works both on NT server and winXP and one that works only on WINXP. One uses CDO to read mail and save the attachment the other tries to send an email. The program that sends the e-mail keeps comming up with an error "E_ACCESSDENIED" where as the other program works fine. Does Anyone have any ideas?
Here is the important part of the code for both applications
Appliation 1 (Sends e-mail) Works on winXP but not NT Server
Dim oSession As New MAPI.Session
Dim oMessage1 As MAPI.Messages
Dim oMessage As MAPI.Message
oSession.Logon "MS Exchange Settings"
Set objFolder = oSession.Outbox
Set oMessage1 = objFolder.Messages
Set oMessage = oMessage1.Add
oMessage.Recipients.Add <name>, <e-mail address>
oMessage.Text = "Hello"
oMessage.Send
oSession.Logoff
Set oSession = Nothing
Appliation 2 (Reads e-mail and saves attachment) Works on winXP and NT Server
Dim osession As New mapi.Session
Dim mess As mapi.Messages
Dim objCurrentMsg As mapi.Message
Dim objFolder As mapi.Folder
Dim Folders1 As mapi.Folders
Dim atach As mapi.Attachment
Dim atachs As mapi.Attachments
osession.Logon "MS Exchange Settings"
Set objFolder = osession.GetDefaultFolder(1)
Set mess = objFolder.Messages
Set objCurrentMsg = mess.GetFirst
For i = 0 To mess.Count - 1
If UCase(objCurrentMsg.Subject) = <Subject> Then
Set atachs = objCurrentMsg.Attachments
Set atach = atachs.Item(1)
atach.WriteToFile (<PATH> & atach.Name)
End if
objCurrentMsg.Delete True
Next
Set objCurrentMsg = mess.GetNext
Next
osession.Logoff
The send e-mail program was working before i installed the second program. Also both programs use the CDO 1.21 libary.
I have been struggling with this for days so any help would be very usefull.