FASTREPORT - MAILExport

FASTREPORT - MAILExport

Postby Otto » Sat Aug 29, 2009 2:29 pm

Hello Marco,

would you be so kind to show how to setup the attachment type
if you use

oFr:SetProperty("MAILExport", "ShowDialog",.f.)

Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: FASTREPORT - MAILExport

Postby Marco Turco » Sat Aug 29, 2009 3:05 pm

Hi,
you can send a report via email using the standard FR mailsender. The big problem of this solution is that it requires the mail account (userid,password, smtp account etc) so I think it is a little complex for the end-use. See FRH manual for a sample.

I personally suggest you to use a more user-friendly solution as an ole connection to Outlook / MAPI in order FR simply open an email with the attachment directly in Outlook or into a MAPI compatible client.

you can make this adding this code at the end of the report
..
..
FrPrn:SetProperty("MailExport","ShowDialog",.f.)
FrPrn:SetEventHandler("MailExport","OnSendMail",{|ParamsArray|MySendMail(FrPrn,cPdfFile)})
..

and with these functions

Function MySendMail(FrPrn,cFile)
local aFiles

FrPrn:SetProperty("PDFExport","OpenAfterExport",.f.)
FrPrn:SetProperty("PDFExport", "ShowDialog", .f.)
FrPrn:SetProperty("PDFExport", "EmbeddedFonts", .f.)
FrPrn:SetProperty("PDFExport", "PrintOptimized", .t.)
FrPrn:DoExport("PDFExport")

aFiles:={}
aadd(aFiles,{cFile,cFile})
InteractiveMessage("","","",aFiles,.f.)
return("")

FUNCTION Interactivemessage()
paramet cSubject, cBody, aTo, aFiles, lDirectSend

LOCAL oOutLook,oMailItem,oRecip,oAttach,i,lOffice,lMailMancante

if lDirectSend=NIL
lDirectSend:=.f.
endif

if cSubject=NIL
cSubject:=""
endif
if cBody=NIL
cBody:=""
endif
if aFiles=NIL
aFiles:=array(0,0)
endif

lMailMancante:=.f.
for i:=1 to len(aTo)
if len(alltrim(aTo[i,2]))=0
lMailMancante:=.t.
endif
next

if lMailMancante
MsgStop("Indirizzo di posta elettronica assente","Attenzione")
return
endif

lOffice:=.t.
TRY
oOutLook := CreateObject( "Outlook.Application" )
oMailItem := oOutLook:CreateItem( 0 )
oRecip := oMailItem:Recipients
CATCH
lOffice:=.f.
END

if lOffice
for i:=1 to len(aTo)
oRecip:Add( aTo[i,2] )
next

oMailItem:Subject := cSubject

oMailItem:Body := cBody

if len(aFiles)>0
oAttach := oMailItem:Attachments
for i:=1 to len(aFiles)
oAttach:Add( aFiles[i,1] )
next
endif

if lDirectSend
oMailItem:Send()
else
oMailItem:display(.t.)
endif
else
for i:=1 to len(aTo)
aTo[i,1]:=alltrim(aTo[i,2])
aTo[i,2]:=alltrim(aTo[i,2])
next


oMail:=tMail():New( cSubject,cBody,,,,, .f., .t.,,aTo,aFiles)

ACTIVATE MAIL oMail
retcode:=oMail:nRetCode

endif
return
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: FASTREPORT - MAILExport

Postby marca » Tue May 23, 2023 6:31 pm

Good afternoon.
Would there be a way to do something similar to generate a spreadsheet in Excel, not using the Fast routine for that, but using My ex routine:

FrPrn:SetProperty("XLSExport", "OpenExcelAfterExport" , .F.) // Abrir o excel
FrPrn:SetEventHandler("XLSExport","OnSendXls",{|ParamsArray|MySendXls(FrPrn,cPdfFile)})
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
marca
 
Posts: 117
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil

Re: FASTREPORT - MAILExport

Postby marca » Thu Jun 01, 2023 9:03 pm

Up
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
marca
 
Posts: 117
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 109 guests