1 /* tclmapi.c - Tcl interface to MAPI.
2 Copyright (C) 1997 Cygnus Solutions
3 Written by Tom Tromey <tromey@cygnus.com>. */
14 #include "subcommand.h"
16 /* Usage for the mapi command:
17 mapi simple-send TO-ADDRESS SUBJECT TEXT.
19 This command has been deliberately kept very simple; it only does
20 what we need. However it can be extended by adding new subcommands
24 mapi_command (ClientData cd, Tcl_Interp *interp, int argc, char *argv[])
30 message.ulReserved = 0;
31 message.lpszSubject = argv[3];
32 message.lpszNoteText = argv[4];
33 message.lpszMessageType = NULL;
34 message.lpszDateReceived = NULL;
35 message.lpszConversationID = NULL;
37 message.lpOriginator = NULL;
38 message.nRecipCount = 1;
39 message.lpRecips = &to;
40 message.nFileCount = 0;
41 message.lpFiles = NULL;
44 to.ulRecipClass = MAPI_TO;
46 /* FIXME: smtp:address? */
47 to.lpszAddress = argv[2];
51 result = MAPISendMail (0, 0, &message, MAPI_LOGON_UI, 0);
52 if (result != SUCCESS_SUCCESS)
54 /* We could decode the error here. */
57 sprintf (buf, "0x%lx", result);
58 Tcl_AppendResult (interp, argv[0], ": failed with status ",
66 static const struct ide_subcommand_table mapi_table[] =
68 { "simple-send", mapi_command, 5, 5 },
73 ide_create_mapi_command (Tcl_Interp *interp)
75 return ide_create_command_with_subcommands (interp, "ide_mapi",
76 mapi_table, NULL, NULL);