473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MAPI mail failure codes??? Where can I find out what failure error code 2 is? How about the rest of the codes?

MLH
I cut a mail function off the m'soft site. Has always worked. However,
I would like to include error codes returned by the sendmail Fn and
be able to understand what they mean. I had my first occasion to
experience a failure and got a code of 2??? Would like to know
just what that means.

Here's how I call the fn...
Result = SendMail((F!Subject), (F!To), (F!CC), (F!Attach),
(F!Message))
And here's the fn.....
Function SendMail (sSubject As String, sTo As String, sCC As String,
sAttach As String, sMessage As String)
Dim i, cTo, cCC, cAttach ' variables holding counts

Dim MAPI_Message As MAPIMessage

' Count the number of items in each piece of the mail message
cTo = CountTokens(sTo, ";")
cCC = CountTokens(sCC, ";")

cAttach = CountTokens(sAttach, ";")

' Create arrays to store the semicolon delimited mailing
' .. information after it is parsed
ReDim rTo(0 To cTo) As String
ReDim rCC(0 To cCC) As String

ReDim rAttach(0 To cAttach) As String

' Parse the semicolon delimited information into the arrays.
ParseTokens rTo(), sTo, ";"
ParseTokens rCC(), sCC, ";"

ParseTokens rAttach(), sAttach, ";"

' Create the MAPI Recip structure to store all the To and CC

' .. information to be passed to the MAPISendMail function
ReDim MAPI_Recip(0 To cTo + cCC - 1) As MapiRecip
' Setup the "TO:" recipient structures
For i = 0 To cTo - 1
MAPI_Recip(i).Name = rTo(i)
MAPI_Recip(i).RecipClass = MAPI_TO
Next i

' Setup the "CC:" recipient structures
For i = 0 To cCC - 1
MAPI_Recip(cTo + i).Name = rCC(i)
MAPI_Recip(cTo + i).RecipClass = MAPI_CC
Next i

' Create the MAPI File structure to store all the file
attachment
' .. information to be passed to the MAPISendMail function
ReDim MAPI_File(0 To cAttach) As MapiFile

' Setup the file attachment structures
MAPI_Message.FileCount = cAttach
For i = 0 To cAttach - 1
MAPI_File(i).Position = -1
MAPI_File(i).PathName = rAttach(i)
Next i

' Set the mail message fields
MAPI_Message.Subject = sSubject
MAPI_Message.NoteText = sMessage
MAPI_Message.RecipCount = cTo + cCC
' Send the mail message
SendMail = MAPISendMail(0&, 0&, MAPI_Message, MAPI_Recip(0),
MAPI_File(0), MAPI_LOGON_UI, 0&)

End Function

Nov 13 '05 #1
2 18988
MLH wrote:
I cut a mail function off the m'soft site. Has always worked. However,
I would like to include error codes returned by the sendmail Fn and
be able to understand what they mean. I had my first occasion to
experience a failure and got a code of 2??? Would like to know
just what that means.


Unfortunately it means "FAILURE". Err.LastDLLError may give you more
information or it may not.

Global Const SUCCESS_SUCCESS = 0
Global Const MAPI_USER_ABORT = 1
Global Const MAPI_E_USER_ABORT = MAPI_USER_ABORT
Global Const MAPI_E_FAILURE = 2
Global Const MAPI_E_LOGIN_FAILURE = 3
Global Const MAPI_E_LOGON_FAILURE = MAPI_E_LOGIN_FAILURE
Global Const MAPI_E_DISK_FULL = 4
Global Const MAPI_E_INSUFFICIENT_MEMORY = 5
Global Const MAPI_E_BLK_TOO_SMALL = 6
Global Const MAPI_E_TOO_MANY_SESSIONS = 8
Global Const MAPI_E_TOO_MANY_FILES = 9
Global Const MAPI_E_TOO_MANY_RECIPIENTS = 10
Global Const MAPI_E_ATTACHMENT_NOT_FOUND = 11
Global Const MAPI_E_ATTACHMENT_OPEN_FAILURE = 12
Global Const MAPI_E_ATTACHMENT_WRITE_FAILURE = 13
Global Const MAPI_E_UNKNOWN_RECIPIENT = 14
Global Const MAPI_E_BAD_RECIPTYPE = 15
Global Const MAPI_E_NO_MESSAGES = 16
Global Const MAPI_E_INVALID_MESSAGE = 17
Global Const MAPI_E_TEXT_TOO_LARGE = 18
Global Const MAPI_E_INVALID_SESSION = 19
Global Const MAPI_E_TYPE_NOT_SUPPORTED = 20
Global Const MAPI_E_AMBIGUOUS_RECIPIENT = 21
Global Const MAPI_E_AMBIG_RECIP = MAPI_E_AMBIGUOUS_RECIPIENT
Global Const MAPI_E_MESSAGE_IN_USE = 22
Global Const MAPI_E_NETWORK_FAILURE = 23
Global Const MAPI_E_INVALID_EDITFIELDS = 24
Global Const MAPI_E_INVALID_RECIPS = 25
Global Const MAPI_E_NOT_SUPPORTED = 26

--
--
Lyle

"The aim of those who try to control thought is always the same. They
find one single explanation of the world, one system of thought and
action that will (they believe) cover everything; and then they try to
impose that on all thinking people."
- Gilbert Highet
Nov 13 '05 #2
MLH
<snip>
I found this snippet on the web and was about to come
back here and post it when I found your answer. Thank-you
Lyle (very much) for your assistance.
************************************************** ****
case MAPIError of
MAPI_E_AMBIGUOUS_RECIPIENT:
Showmessage('A recipient matched more than one of the
recipient descriptor structures and MAPI_DIALOG was not set. No
message was sent.');
MAPI_E_ATTACHMENT_NOT_FOUND:
Showmessage('The specified attachment was not found; no
message was sent.');
MAPI_E_ATTACHMENT_OPEN_FAILURE:
Showmessage('The specified attachment could not be
open; no message was sent.');
MAPI_E_BAD_RECIPTYPE:
Showmessage('The type of a recipient was not MAPI_TO,
MAPI_CC, or MAPI_BCC. No message was sent.');
MAPI_E_FAILURE:
Showmessage('One or more unspecified errors occurred;
no message was sent.');
MAPI_E_INSUFFICIENT_MEMORY:
Showmessage('There was insufficient memory to proceed.
No message was sent.');
MAPI_E_LOGIN_FAILURE:
Showmessage('There was no default logon, and the user
failed to log on successfully when the logon dialog box was displayed.
No message was sent.');
MAPI_E_TEXT_TOO_LARGE:
Showmessage('The text in the message was too large to
sent; the message was not sent.');
MAPI_E_TOO_MANY_FILES:
Showmessage('There were too many file attachments; no
message was sent.');
MAPI_E_TOO_MANY_RECIPIENTS:
Showmessage('There were too many recipients; no message
was sent.');
MAPI_E_UNKNOWN_RECIPIENT:
Showmessage('A recipient did not appear in the address
list; no message was sent.');
MAPI_E_USER_ABORT:
Showmessage('The user canceled the process; no message
was sent.');
SUCCESS_SUCCESS:
Showmessage('MAPISendMail successfully sent the
message.');
else
Showmessage('MAPISendMail failed with an unknown error
code.');
end;

As you can see, it gives me clues as to the range of errors returned.
Trouble is, I get numbers returned as error codes and I do not know
what they mean. For instance, I get the number 2. Is there somewhere
on the InterNET I can go see the MAPI error codes and descriptions?
I am using 16-bit MAPI.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Chris | last post by:
I'm trying to send an e-mail through outlook. So far I've gotten it to work with the mail script at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/149461 My only problem is that when I...
0
by: David Burson | last post by:
Hi, I have a VB.NET windows app that needs to automatically send a simple text email when my users run a new version of the app for the first time. I thought this would be simple, but after...
0
by: DC Fan | last post by:
I am wirting an application in Access 2002 (XP) that needs to send email. Since I hate the dialog boxes you get from all the Outlook warning messages, I am trying to use the MAPI object. On *SOME*...
0
by: Lumpierbritches | last post by:
Option Compare Database Option Explicit '************ Code Start ********** 'This code was originally written by Dev Ashish. 'It is not to be altered or distributed, 'except as part of an...
7
by: Ottar | last post by:
I've made a program sorting incomming mail in public folder. The function runs every minute by using the form.timer event. In Access XP it runs for weeks, no problem. Access 2003 runs the same...
3
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and...
1
by: tomer.ha | last post by:
Hi there, I'd like to send emails from a Python program using Simple MAPI. I've tried this code: http://mail.python.org/pipermail/python-list/2004-December/298066.html and it works well with...
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
15
by: squrel | last post by:
Hi everyone.. i need ur help once more time.... i have a form called reminder..in tht form i have: txtid, txtcaseid, txtreminder, cmbremindby(system or user), txtremindto, dtpreminddt,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.