VMS Version V5.0 makes MAIL available as a set of callable routines but the documentation for them was not shipped. This article gives an example of a simple Macro program to send a single-line message to a single username plus a few tips for further elaboration. A fuller discussion can be found on the VAX88B US SIG tape (in [VAX88B5.RCAF88.NETF88]MAILSHR.DOC). To link this: $ MACRO TEST_MAIL $ LINK TEST_MAIL .title test_mail Test Callable MAIL .ident /VMS V5.0/ $maildef ; in SYS$LIBRARY:STARLET.MLB ; see also SYS$LIBRARY:STARLET.REQ which has comments .psect data,wrt,noexe,nopic,noshr send_type: .word mail$_to ; username is "TO" not "CC" send_to: .ascii /SYSTEM/ ; the username - can be a s_send_to = .-send_to ; logical name but not a ; distribution list send_subj: .ascii /Testing callable mail/ ; "Subject:" s_send_subj = .-send_subj send_line: .ascii /Line 1/ ; line 1 of message s_send_line = .-send_line send_context: .blkl 1 ; MAIL context ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; MAIL item lists. The format is the normal one (c.f. $GETJPI, etc.) send_begin_in_list: .long 0 ; MAIL$SEND_BEGIN send_begin_out_list: .long 0 send_tx_in_list: .long 0 ; MAIL$SEND_MESSAGE send_tx_out_list: .long 0 send_end_in_list: .long 0 ; MAIL$SEND_END send_end_out_list: .long 0 send_addr_in_list: ; MAIL$SEND_ADD_ADDRESS .word s_send_to,mail$_send_username .address send_to,0 .word 2,mail$_send_username_type .address send_type,0 .long 0 send_addr_out_list: .long 0 send_attr_in_list: ; MAIL$SEND_ADD_ATTRIBUTE .word s_send_subj,mail$_send_subject .address send_subj,0 .long 0 ; Other ADD_ATTRIBUTE item codes: ; mail$_send_pers_name -- specifies the personal name ; mail$_send_no_pers_name -- don't use a personal name send_attr_out_list: .long 0 send_body_in_list: ; MAIL$SEND_ADD_BODYPART .word s_send_line,mail$_send_record .address send_line,0 .long 0 ; Other ADD_BODYPART item codes: ; mail$_send_filename -- a file spec for a text file ; mail$_send_default_name -- default file spec for text files send_body_out_list: .long 0 .psect code,exe,nowrt,pic,shr .entry test_mail,^m<> pushal send_begin_out_list pushal send_begin_in_list pushal send_context calls #3,g^mail$send_begin ; create a new message bsbw error ; ready to be sent pushal send_attr_out_list pushal send_attr_in_list pushal send_context calls #3,g^mail$send_add_attribute ; add attribute to current bsbw error ; message header pushal send_body_out_list pushal send_body_in_list pushal send_context calls #3,g^mail$send_add_bodypart ; add a line to the bsbw error ; message body pushal send_addr_out_list pushal send_addr_in_list pushal send_context calls #3,g^mail$send_add_address ; add an address ("to:") bsbw error ; repeat for additional ; "to" or "cc" usernames pushal send_tx_out_list pushal send_tx_in_list pushal send_context calls #3,g^mail$send_message ; send to given address list bsbw error pushal send_end_out_list pushal send_end_in_list pushal send_context calls #3,g^mail$send_end ; tidy up bsbw error ret error: blbc r0,0$ rsb 0$: ret .end test_mail