Avatar of jglapski
jglapski

asked on 

Program stopped writing PDF file and stopped sending mail

I wrote a program that was designed to do two things:
-download a PDF file and save it to a local drive
-send an email with a PDF attachment and a link to the original file

The program has worked at times, but the downloading of the PDF file has not worked, and what it does is simply leave a blank PDF document.

This week, the program stopped sending out emails.

I am at a loss to explain either behavior. The email addresses, file names and directories have been changed in the example below. The m.file1 variable has a length of 142 characters.
m.file1="http://www.notarealurl.com/example/example/"+subs(dtos(m.date1),5,2)+righ(dtos(m.date1),2)+subs(dtos(m.date1),3,2)+".pdf"
m.file2=""c:\test.pdf"
m.text="This is the PDF, which is also found on the Portal at: "+m.file1
 
decl inte URLDownloadToFile in urlmon.dll inte pCaller, stri szURL, stri szFileName, inte dwReserved, inte lpfnCB
 
=URLdownloadtofile(0,(m.file1),(m.file2),0,0)
 
if file(m.file2)
oMSG = createobject("CDO.Message")
oMSG.To = "null@null.com"
oMSG.From =  "null@null.com"
oMSG.Replyto =  "null@null.com"
oMSG.Subject = "PDF"
oMSG.TextBody= m.text
oMSG.addattachment(m.file2)
oMSG.MimeFormatted=.t.
oMSG.Send()
endi

Open in new window

FoxPro

Avatar of undefined
Last Comment
jglapski

8/22/2022 - Mon