FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Send attachments via mapi
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Send attachments via mapi
Posted: Wed Jun 11, 2014 01:01 PM

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

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Send attachments via mapi
Posted: Wed Jun 11, 2014 01:42 PM
Marco,

Try
Code (fw): Select all Collapse
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
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Send attachments via mapi
Posted: Wed Jun 11, 2014 01:44 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Send attachments via mapi
Posted: Wed Jun 11, 2014 11:05 PM

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. )

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Send attachments via mapi
Posted: Fri Jun 13, 2014 08:31 AM

Hi all,
thank you for the support.
Anyway I solved using the MapiSendMail function and it runs well.

Best Regards,



Marco Turco

SOFTWARE XP LLP

Continue the discussion