Updated May 2011
xcall MIAMEX, MX_MAPI, status, fspec {,flags, subject, text, xdata, fspec2, fspec3, ...fspecn}
(Windows only) MX_MAP provides a simple way to send the contents of a file via interactive email. It launches the current email client program (e.g. Outlook, Eudora, etc.) and then inserts the contents of the file into the body of the message. The user has only to address the message and optionally type in introductory comments. To send email without user interaction, an A-Shell module called EMAILX is available from MicroSabio.
Note that this call requires that the Windows "Simple MAPI" interface be installed. This will happen automatically in most cases, as it is included in Outlook Express. But it is not installed by default with the full server version of Exchange Server. In that case, you need to manually install the "simple MAPI" subsystem from your Windows media or Microsoft.
status (F,6)
will return a status code indicating the success or failure of the operation, from the following table. Note that the negative error numbers relate to errors within the MIAMEX subroutine, while the positive errors are returned from the MAPI interface itself.
Value |
Meaning |
|
Value |
Status |
0 |
Success |
|
11 |
MAPI Attachment not found |
-1 |
MAPI interface not available on this computer |
|
12 |
MAPI Error opening attachment |
-2 |
Unable to load mapi32.dll |
|
13 |
MAPI Error writing attachment |
-3 |
Unable to get address of MAPI SendMail function |
|
14 |
MAPI Unknown recipient |
-4 |
Unable to allocate memory |
|
15 |
MAPI Bad receipt type |
-5 |
Unable to open fspec |
|
16 |
MAPI No messages |
-7 |
fspec not found |
|
17 |
MAPI Invalid message |
1 |
MAPI User abort |
|
18 |
MAPI Text too large |
2 |
MAPI General failure |
|
19 |
MAPI Invalid session |
3 |
MAPI Logon failure |
|
20 |
MAPI Type not supported |
4 |
MAPI Disk full |
|
21 |
MAPI Ambiguous recipient |
5 |
MAPI Insufficient memory |
|
22 |
MAPI Message in use |
6 |
MAPI Access denied |
|
23 |
MAPI Network failure |
8 |
MAPI Too many sessions |
|
24 |
MAPI Invalid edit fields |
9 |
MAPI Too many files |
|
25 |
MAPI Invalid recipients |
10 |
MAPI Too many recipients |
|
26 |
MAPI Not supported |
fspec
is the file specification (AMOS or native format) of the file to send via email.
flags (Optional, Num)
may contain any combination of the following values:
Value |
Meaning |
1 |
Receipt requested |
2 |
Send file(s) as attachments |
4 |
Send using HTML fixed pitch |
12 |
Very small fixed type |
32 |
Send without user interface (see Comments below) |
subject (optional, String)
may be set to the desired subject of the message. (Otherwise the user can type a subject in interactively.)
text (optional, String)
may be set to any text which will be inserted in the message prior to the specified file. (This might be useful for introductory comments.)
xdata (optional, String)
May contain a single recipient address, using either of these formats:
johndoe@somedomain.com
John Doe <johndoe@somedomain.com>
Note that in the second case, the friendly name may or may not actually get picked up by the email client, but the actual email address should be recognized in either case.
fspec2...fspecn (String)
specifies additional attachments (if you have more than one).
Comments
If flag 32 is used to send the message without user interaction in the email client, you must include a valid recipient address in the xaddr parameter. Even then, because of the security risks of letting programs "commandeer" the email client to send messages in this way, the client may reject the attempt entirely, or it may prompt the user for confirmation. These kinds of responses by the email client are outside of the control of A-Shell.
To send mail without user interface and with more control, see A-Shell's EMAILX module. For sending email messages from an application after first creating a PDF file, see the PDFX module.
History
2008 November, A-Shell 5.1.1130: Add flag 32 and support recipient address in the xdata param.
2006 May, A-Shell 4.9.957: Update to current syntax. Old syntax: xcall MIAMEX, MX_MAPI, status, fspec {,flags, subject, text}