• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 405
  • Last Modified:

Using MAPI Active X Control and attachments.

Hi I'm trying to add an attachment to an email application.
I can create the email and send it but I keep getting an error every time I try and attach text file like so:

I've logged on the MAPI server already

MAPIMess.Action = 6
       

MAPIMess.RecipIndex = 0
MAPIMess.RecipDisplayName = "eric07@earthlink.net"
MAPIMess.MsgSubject = "This is a test"

MAPIMess.Action = 3

will send the email and I receive it ok

but know to add the code to add the
autoexec.bat as an attachment I get errors.

MapiMess.AttachmentIndex = MapiMess.AttachmentCount
MapiMess.AttachmentName = "autoexec.bat"        
MapiMess.AttachmentPathName = "c:\autoexec.bat"
MapiMess.AttachmentPosition = MapiMess.AttachmentIndex
MapiMess.AttachmentType = 0

MAPIMess.Action = 3

can anyone help figure this out.
Thanks
0
eric07
Asked:
eric07
  • 4
  • 3
1 Solution
 
Erick37Commented:
I believe if you have an .AttachmentPosition value, you must assign text in the .msgNoteText property.  And the value of .AttachmentPosition must be <= Len(.msgNoteText)

P.S what is the error you are getting?
0
 
eric07Author Commented:
Runtime error: '32002'

Unspecified failure has occured

 MAPIMess.MsgSubject = "This is a test"
           MAPIMess.AttachmentIndex = MAPIMess.AttachmentCount
            MAPIMess.AttachmentIndex = MAPIMess.AttachmentIndex
           MAPIMess.AttachmentName = "autoexec.bat"
            MAPIMess.AttachmentPathName = "c:\autoexec.bat"
            MAPIMess.MsgNoteText = "Note Text"
            MAPIMess.AttachmentPosition = Len(MAPIMess.MsgNoteText)
            MAPIMess.AttachmentType = 0

Thanks
0
 
eric07Author Commented:
Runtime error: '32002'

Unspecified failure has occured

 MAPIMess.MsgSubject = "This is a test"
           MAPIMess.AttachmentIndex = MAPIMess.AttachmentCount
            MAPIMess.AttachmentIndex = MAPIMess.AttachmentIndex
           MAPIMess.AttachmentName = "autoexec.bat"
            MAPIMess.AttachmentPathName = "c:\autoexec.bat"
            MAPIMess.MsgNoteText = "Note Text"
            MAPIMess.AttachmentPosition = Len(MAPIMess.MsgNoteText)
            MAPIMess.AttachmentType = 0

Thanks
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Erick37Commented:
"PRB: Error 32002 "Unspecified Error" When Adding an Attachment"

http://support.microsoft.com/support/kb/articles/Q173/8/53.ASP
0
 
Erick37Commented:
Here's another KB dealing with setting the .AttachmentPosition

http://support.microsoft.com/support/kb/articles/Q186/1/48.ASP

Also, if you only have one attachment, set the .AttachmentIndex = 0.
0
 
eric07Author Commented:
Thank you,
it solved my problem.

yeah
0
 
Erick37Commented:
Great! :-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now