¿Alguna sugerencia?
Code: Select all
METHOD SendEmail() CLASS TPreview
local oMail, cName, cFile, olMailItem
cName := If( ::oReport != nil, ::oReport:cName, ::oDevice:cDocument )
cFile := cFilePath( ::oDevice:aMeta[ 1 ] ) + StrTran( cName, '.', '' ) + ".pdf"
CursorWait()
cFile := ::SaveAs( .t., cFile, .f. )
CursorArrow()
if ! File( cFile )
MsgInfo( FWString( "PDF not saved to send Email" ), FWString( "Information" ) )
elseif ::bEmail != nil
Eval( ::bEmail, Self, cName, cFile )
else
oOutlook := CreateObject( "Outlook.Application" )
oMail := oOutlook:CreateItem( olMailItem )
with object oMail
oMail:Subject = cName
oMail:BodyFormat = olFormatHTML
oMail:Recipients:Add( Alltrim(vmailpre) )
oMail:Attachments:Add( cFile )
oMail:Display = .T.
END
endif
::oMeta1:SetFocus()
return nil