RE: Automatically E-mail Reports
From: Lee Mitchell (Leemi_at_online.microsoft.com)
Date: 08/03/04
- Next message: Andrew Howell: "Re: FPW2.6a changing browse title"
- Previous message: Ook: "Re: Watch for a fake bill"
- In reply to: Tom Wright: "Automatically E-mail Reports"
- Next in thread: Tom Wright: "Re: Automatically E-mail Reports"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 03 Aug 2004 15:42:53 GMT
Hi Tom:
I don't know anything about eReports. I f someone else does, well then
they can chime in.
If you want to create HTML output from a report in VFP you can use GenHTML
as shown in this article:
191927 HOWTO: Use GENHTML to Create HTML from a Visual FoxPro Report
http://support.microsoft.com/?id=191927
The HTML does not preserve all the shapes and colors of a report, but if
you have a simple looking report, this will work fine.
Now, you can use SMPT to send the mail. Universalthread.com has a lot of
code examples and controls you can download to use SMTP. Go to
www.universalthread.com, click on the VFP Zone icon, and choose Downloads
icon. In the Summary text box of the query page, search for "SMTP."
If you want to use MAPI to send the attachments, then look at this code:
181899 PRB: Multiple E-mail Attachments Cause Error with MSMAPI OCX
http://support.microsoft.com/?id=181899
175052 HOWTO: Send a Message in Visual FoxPro Using Active Messaging
http://support.microsoft.com/?id=175052
If you have a lot of e-mails to send, they you probably want to use SMTP
since it is faster when handling large volumes of mail. However, some
people find MAPI easier to program.
I hope this helps.
This posting is provided "AS IS" with no warranties, and confers no rights.
Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell
*-- VFP9 Public Beta Now Available!! --*
Download the VFP9 beta here: http://msdn.microsoft.com/vfoxpro/
*-- VFP8 HAS ARRIVED!! --*
Read about all the new features of VFP8 here:
http://www.universalthread.com/VisualFoxPro/News/VFP8Release.asp
Purchase VFP8 here:
http://shop.microsoft.com/Referral/Productinfo.asp?siteID=11518
Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003
>I'm new to this group and need some help. I consider myself a novice
>when it comes to VFP. I'm looking for an easy way to modify our
>database to automatically E-mail packing lists to a static E-mail
>address at one of our sister companies. I'm finding this a challenge
>because there are no comments in the code and I was given no
>programmers documentation.
>I found a plugin called eReports that will do this, but I can't for
>the life of me follow their examples. I'd like to convert the report
>to .htm format then I'd like to send it out as an attachment without
>the user noticing. Before everyone starts yelling "post on eReports
>forum for help" I've already posted a message on their forum and
>haven't received response yet.
>I'm running Visual FoxPro 6.0 with Service Pack 3. Any help would be
>appreciated.
***** Here is the eReports snippet for converting to htm format ******
LOCAL lnResult, oHTML
oHTML = NEWOBJECT("eReportsHTML", "eReports.dll", "eReports.dll")
oHTML.ReportFile = "myReport.frx"
lnResult = oHTML.ReportConvert()
RELEASE oHTML
***** Here is the eReports snippet for SMTP *****
LOCAL loSMTP, lcRecipient, lcName, lnResult
loSMTP = NEWOBJECT("eReportsSMTP","eReports.dll","eReports.dll")
loSMTP.Unlock("Organization - E8FTY 4JR8S 2JX4R 49FJR")
loSMTP.SMTPServer = "mail.johndoe.com"
*-While not required, some SMTP servers need this. If you get -505
*-error, this is the likely solution.
loSMTP.SMTPDomain = "johndoe.com"
*-Optional
loSMTP.SMTPLogFile = "c:\SMTPLog.txt"
loSMTP.FromAddress = "support@johndoe.com"
loSMTP.FromName = "Support"
loSMTP.Subject = "Test"
loSMTP.MessageBody = "This is a test"
*-Alternatively Insert a message file between the quotes below
*-The message file can be an exisiting boilerplate text/rtf file or an
*-html file generated by eReports.
*-If the message file is HTML, set the MessageFormat property to 1 or
2 (see help)
*loSMTP.MessageFormat = && valid parameters are 0,1,2,3 (see help)
*loSMTP.MessageFile = "" && "C:\eReports\Output\myreport.htm"
*-The first parameter is the friendly name like "John Doe" or "" for
empty
*-The second parameter must be a valid email address
*-The third parameter is the recipient type - 1=Normal, 2=CC, 3=BCC
lcRecipient = "jdoe@johndoe.com"
lcName = "John Doe"
loSMTP.AddRecipient(lcName,lcRecipient,1)
*-Include an optional attachment file by adding the file name between
the quotes
*-below or using a variable that points to an existing file.
lnResult = loSMTP.AddAttachment((lcPDFFile))
lnResult = loSMTP.SendMail()
IF lnResult = 0
MESSAGEBOX("Message Sent",0,"System Message")
ELSE
MESSAGEBOX("An Error occured:"+CHR(13)+loSMTP.ErrorLog,0,"System
Message")
ENDIF
RELEASE oSMTP
***** This is the Exit command button code where the packing lists are
printed in our database *****
if times=0
thisform.mybutton1.cmdnext.click
endif
private is_tally
is_tally=0
thisform.label1.visible=.t.
thisform.edton_hold.enabled=.f.
thisform.command1.enabled=.f.
thisform.refresh
select exe_packinglist_0
replace on_hold_a with thisformset.form3.edton_hold.value
if tableupdate(.t.)=.f.
messagebox("Error in saving exe_packinglist_0.",0+16,"Error")
tablerevert(.t.)
else
thisform.lockscreen=.t.
scan
thisformset.qtyorder_num=exe_packinglist_0.order_num_a
thisformset.qtyseq=exe_packinglist_0.packing_seq
=requery("exe_packinglist")
select exe_packinglist
replace on_hold with exe_packinglist_0.on_hold_a all
if tableupdate(.t.)=.f.
messagebox("Error saving exe_packinglist
"+alltrim(Exe_packinglist.model_a)+".",0+16,"Error")
tablerevert(.t.)
endif
select exe_packinglist_0
endscan
thisform.lockscreen=.f.
endif
thisform.label1.visible=.f.
thisform.edton_hold.enabled=.t.
thisform.command1.enabled=.t.
thisform.refresh
select approval_pl
scan
thisformset.qtyorder_num=approval_pl.order_num
thisformset.qtyseq=approval_pl.seq
=requery("doc_pl")
if _tally!=0
is_tally=1
report form doc_pl to printer noconsole
endif
endscan
if _tally<>0
thisformset.form4.visible=.t.
thisformset.form4.show
thisform.enabled=.f.
endif
****************************************
>Again, if anyone can point me in the right direction (or at least help
>me get started), I would appreciate it.
>Best regards,
>Tom
- Next message: Andrew Howell: "Re: FPW2.6a changing browse title"
- Previous message: Ook: "Re: Watch for a fake bill"
- In reply to: Tom Wright: "Automatically E-mail Reports"
- Next in thread: Tom Wright: "Re: Automatically E-mail Reports"
- Messages sorted by: [ date ] [ thread ]