Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Using attachments in a MAPI message (Functions/Subroutines/Programs) ====== ====== ====== ==== Created at 15 OCT 1996 05:03PM ==== This is an example of how to send a MAPI mail message with an attachment using Microsoft Mail. The most common error is using the Microsoft Mail type of "IPM.Microsoft Mail.Note" for the POS_TYPE$ field, instead of "IPM." required for attachments. Also note that the POS_PATHS$ value contains the full drive and path of the attachment, including the file name. The file name by itself also appears in thePOS_FILES$ position. Additionally, the value of POS_POSITIONS$ must be 2 less than the length of the message body. declare subroutine Msg, Get_Status declare function MapiSendMail $insert Mapi_Equates equ CRLF$ to \0D0A\ equ CR$ to \0D\ equ LF$ to \0A\ equ TAB$ to \09\ * this example of sending a mail message is called from * a form that contains the following controls: * - TextMessage edit box * - CompanyName edit line * - CompanyAddress edit line * - Region edit line * - OrderData edit table * - Subject edit line * - To edit line * - FileName editline Txt = .TextMessage->Text : CRLF$ Txt := "Company: ": .CompanyName->Text : CRLF$ Txt := "Address: ": .CompanyAddress->Text: CRLF$ Txt := "Region : ": .Region->Text : CRLF$ Orders = .OrderData->List convert @fm:@vm to LF$:TAB$ in Orders Txt := Orders FullFileName = .FileName->Text FileName = FileName[-1,'B\'] Flags = MAPI_LOGON_UI$ + MAPI_DIALOG$ Message = '' Message<POS_SUBJECT$ > = .Subject->Text Message<POS_TO$ > = .To->Text Message<POS_TEXT$ > = Txt Message<POS_FLAGS$ > = MAPI_RECEIPT_REQUESTED$ Message<POS_TYPE$ > = "IPM." Message<POS_FILES$ > = FileName Message<POS_PATHS$ > = FullFileName Message<POS_POSITIONS$> = len( message<POS_TEXT$>) - 2 if MAPISendMail(0, 0, Flags, Message) then Msg(@window, "Message sent successfully!") end else Get_Status(ErrMsg) Msg(@window, ErrMsg) end return 0 %%__%%%%__%%%%__%%%%__%% See also: MAPISendMail, MAPI_Equates insert record Source code: [[http://o4w.revelation.com/o4wtrs/KB_Articles/KB0040_files/Example.txt|{{Missing - https://o4w.revelation.com/o4wtrs/KB_Articles/KB0040_files/image004.png?71x48}}]] kb/kb_articles/kb0040.txt Last modified: 2024/01/30 13:36by 127.0.0.1