Page 1 of 1

Send attachments via mapi

PostPosted: Wed Jun 11, 2014 1:01 pm
by Marco Turco
Hi all,
do you have a working sample to send emails with attachments using mapi ?
I made this sample but I receive the email without the attachment.

function DirectMessage()

local oMail

AFILES:={}
AADD(AFILES,"K:\FWH\SAMPLES\TESTMAIL.PRG")

DEFINE MAIL oMail ;
SUBJECT "FiveWin Mail-control power" ;
TEXT "This is real xBase power at your fingertips!" ;
TO "xxx@test.co.uk";
FILES AFILES

ACTIVATE MAIL oMail

MsgInfo( oMail:nRetCode )

return nil

Re: Send attachments via mapi

PostPosted: Wed Jun 11, 2014 1:42 pm
by Marc Vanzegbroeck
Marco,

Try
Code: Select all  Expand view
DEFINE MAIL oMail ;
SUBJECT "FiveWin Mail-control power" ;
TEXT "This is real xBase power at your fingertips!" ;
TO "xxx@test.co.uk";
FILES "K:\FWH\SAMPLES\TESTMAIL.PRG","TESTMAIL.PRG"

ACTIVATE MAIL oMail

Re: Send attachments via mapi

PostPosted: Wed Jun 11, 2014 1:44 pm
by James Bott
Marco,

I don't see anything wrong with your test. Maybe you had the attachment open in an editor? Also try a ZIP file, maybe the server doesn't recognize the extension.

James

Re: Send attachments via mapi

PostPosted: Wed Jun 11, 2014 11:05 pm
by TimStone
This has been working fine for me:

FUNCTION SendMAPIMail2( MailTo, cSndFile, cText, cSubj )
LOCAL oMail

DEFINE MAIL oMail ;
SUBJECT cSubj ;
TEXT cText ;
FILES cSndFile, cSndFile ;
FROM USER ;
TO MailTo

ACTIVATE MAIL oMail

RETURN( .t. )

Re: Send attachments via mapi

PostPosted: Fri Jun 13, 2014 8:31 am
by Marco Turco
Hi all,
thank you for the support.
Anyway I solved using the MapiSendMail function and it runs well.