S
Stuart Crow
Hello all
A client has requested that a program which I look after be able
to send emails with a Word document as an attachment. The program is
written in VB6 and the OS is WIN2K.
The code to send the email is :
Dim olApp As Outlook.Application
Dim olNs As Outlook.NameSpace
Dim olMail As Outlook.MailItem
' create Outlook instance
' and set properties
Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon
Set olMail = olApp.CreateItem(olMailItem)
' email address to send to
olMail.To = mstrEmailToAddress
' from email address - allows single address for all
replies
olMail.SentOnBehalfOfName = strEMailFromAddress
olMail.Subject = "Refreshments Booking"
olMail.Body = vbNullString
' attach the Word document
olMail.Attachments.Add strAttachName
olMail.Send
MsgBox ("Email sent")
olNs.Logoff
Set olMail = Nothing
Set olNs = Nothing
Set olApp = Nothing
When I exercise this functionality from my work pc using Outlook 2002
with Lotus Notes as an email server it works OK every time.
The client, howevre, uses Outlook 2002 with Exchange 2003 as the
server.
Every time he tries to send the email he gets Outlook error
-2009661435
You do not have the permission to send the message on behalf of the
specified user.
From what they have said, they have set up a mailbox with two
profiles,
the permissions are set on the mailbox so that the user is editor and
can create items. Emails can be sent from the mailbox but nor from the
program.
Can anyone give me an idea how to fix this problem ?
TIA
Stuart
A client has requested that a program which I look after be able
to send emails with a Word document as an attachment. The program is
written in VB6 and the OS is WIN2K.
The code to send the email is :
Dim olApp As Outlook.Application
Dim olNs As Outlook.NameSpace
Dim olMail As Outlook.MailItem
' create Outlook instance
' and set properties
Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon
Set olMail = olApp.CreateItem(olMailItem)
' email address to send to
olMail.To = mstrEmailToAddress
' from email address - allows single address for all
replies
olMail.SentOnBehalfOfName = strEMailFromAddress
olMail.Subject = "Refreshments Booking"
olMail.Body = vbNullString
' attach the Word document
olMail.Attachments.Add strAttachName
olMail.Send
MsgBox ("Email sent")
olNs.Logoff
Set olMail = Nothing
Set olNs = Nothing
Set olApp = Nothing
When I exercise this functionality from my work pc using Outlook 2002
with Lotus Notes as an email server it works OK every time.
The client, howevre, uses Outlook 2002 with Exchange 2003 as the
server.
Every time he tries to send the email he gets Outlook error
-2009661435
You do not have the permission to send the message on behalf of the
specified user.
From what they have said, they have set up a mailbox with two
profiles,
the permissions are set on the mailbox so that the user is editor and
can create items. Emails can be sent from the mailbox but nor from the
program.
Can anyone give me an idea how to fix this problem ?
TIA
Stuart