For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Controls > January 2005 > MAPI Error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MAPI Error
BR

2005-01-29, 8:57 am

I'm using VB 6.0 with MAPI controls to automatically send a report. Below is
the code. I'm getting the following error - 32002 Unspecified failure
occured

Function sendMail()

Const SESSION_SIGNON = 1
Const MESSAGE_COMPOSE = 6
Const ATTACHTYPE_DATA = 0
Const RECIPTYPE_TO = 1
Const RECIPTYPE_CC = 2
Const MESSAGE_RESOLVENAME = 13
Const MESSAGE_SEND = 3
Const SESSION_SIGNOFF = 2

With frmMain
.MAPISession.Action = SESSION_SIGNON
.MAPIMessages.SessionID = .MAPISession.SessionID
.MAPIMessages.Action = MESSAGE_COMPOSE
.MAPIMessages.MsgSubject = "email subject..."
.MAPIMessages.MsgNoteText = "Attached is the Services Report "
.MAPIMessages.RecipIndex = 0
.MAPIMessages.RecipType = RECIPTYPE_TO
.MAPIMessages.RecipDisplayName = "Name goes here"
.MAPIMessages.RecipAddress = "myname@myemail.net"

.MAPIMessages.AttachmentPosition = Len(.MAPIMessages.MsgNoteText)
.MAPIMessages.AttachmentType = mapData
.MAPIMessages.AttachmentName = "Open Report"
.MAPIMessages.AttachmentPathName = "c:\AllRequests.htm"

.MAPIMessages.Show
.MAPIMessages.Send True <- error occurs here
.MAPISession.SignOff
End With
Exit Function

End Function

Thanks for any pointers. This is the only thing holding me up on this
project.

Jan Hyde

2005-01-31, 9:04 am

"BR" <BR@discussions.microsoft.com>'s wild thoughts were
released on Sat, 29 Jan 2005 04:33:04 -0800 bearing the
following fruit:

>I'm using VB 6.0 with MAPI controls to automatically send a report. Below is
>the code. I'm getting the following error - 32002 Unspecified failure
>occured
>
>Function sendMail()
>
> Const SESSION_SIGNON = 1
> Const MESSAGE_COMPOSE = 6
> Const ATTACHTYPE_DATA = 0
> Const RECIPTYPE_TO = 1
> Const RECIPTYPE_CC = 2
> Const MESSAGE_RESOLVENAME = 13
> Const MESSAGE_SEND = 3
> Const SESSION_SIGNOFF = 2
>
> With frmMain
> .MAPISession.Action = SESSION_SIGNON
> .MAPIMessages.SessionID = .MAPISession.SessionID
> .MAPIMessages.Action = MESSAGE_COMPOSE
> .MAPIMessages.MsgSubject = "email subject..."
> .MAPIMessages.MsgNoteText = "Attached is the Services Report "
> .MAPIMessages.RecipIndex = 0
> .MAPIMessages.RecipType = RECIPTYPE_TO
> .MAPIMessages.RecipDisplayName = "Name goes here"
> .MAPIMessages.RecipAddress = "myname@myemail.net"
>
> .MAPIMessages.AttachmentPosition = Len(.MAPIMessages.MsgNoteText)
> .MAPIMessages.AttachmentType = mapData
> .MAPIMessages.AttachmentName = "Open Report"
> .MAPIMessages.AttachmentPathName = "c:\AllRequests.htm"
>
> .MAPIMessages.Show
> .MAPIMessages.Send True <- error occurs here
> .MAPISession.SignOff
> End With
> Exit Function
>
>End Function
>
>Thanks for any pointers. This is the only thing holding me up on this
>project.


Make sure you tell it to ResolveAddress (or whatever the
command is) and ensure that any attachments are not at
position 0.



Jan Hyde (VB MVP)

--
Misery: A collection of misers. (Leo Roston)

[Abolish the TV Licence - http://www.tvlicensing.biz/]

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com