I use Outlook to send emails with attachments.
Like this:
******Code
oOutlookObject = Createobject('Outlook.Application')
olNameSpace = oOutlookObject.GetNameSpace('MAPI')
oItems= olNameSpace.GetDefaultFolder(olFolderInBox).Items
olFolder = olNameSpace.GetDefaultFolder(6)
olFolder.Display
oOutlookObject.Explorers.Item(1).WindowState = 1
oEmailItem = oOutLookObject.CreateItem(MAILITEM)
WITH oEmailItem
.Recipients.Add(lcAddress) && uses the Recipients collection
.Subject = lcSubject
.Importance = IMPORTANCENORMAL
.Body = lcBody
.Attachments.Add("C:\TFCM\DOCS\" + lcFile) && Note that the fully qualified path and file is required.
.Send
ENDWITH
RELEASE oEmailItem
oOutLookObject.quit
RELEASE oOutLookObject
********
The problem is Outlook is trying to quit before the item has been sent.
How do I get outlook to wait until the mail is sent before trying to quit?
Regards
Alastair
Like this:
******Code
oOutlookObject = Createobject('Outlook.Application')
olNameSpace = oOutlookObject.GetNameSpace('MAPI')
oItems= olNameSpace.GetDefaultFolder(olFolderInBox).Items
olFolder = olNameSpace.GetDefaultFolder(6)
olFolder.Display
oOutlookObject.Explorers.Item(1).WindowState = 1
oEmailItem = oOutLookObject.CreateItem(MAILITEM)
WITH oEmailItem
.Recipients.Add(lcAddress) && uses the Recipients collection
.Subject = lcSubject
.Importance = IMPORTANCENORMAL
.Body = lcBody
.Attachments.Add("C:\TFCM\DOCS\" + lcFile) && Note that the fully qualified path and file is required.
.Send
ENDWITH
RELEASE oEmailItem
oOutLookObject.quit
RELEASE oOutLookObject
********
The problem is Outlook is trying to quit before the item has been sent.
How do I get outlook to wait until the mail is sent before trying to quit?
Regards
Alastair