I have a very simple script that I picked up from the A5 help, to generate ,print and email an invoice, it runs fine but it doesn't send the email.
I ran all the lines thru the interactive code, it ran fine, yet from the web page it creates the invoice but doesn't email it.
Any suggestion how to debug this ?
here's the code:
report=alltrim(CurrentForm.Controls.ReportList)
email_address= alltrim(CurrentForm.Controls.email_address)
Give_In_Firm= alltrim(CurrentForm.Controls.Give_In_Firm)
IF eval_valid("email_address") = .f. Then
goto skip_report
end if
IF eval_valid("from_date") = .f. Then
goto skip_report
end if
if eval_valid("to_date") = .f. Then
goto skip_report
end if
'--------------------
if (from_date = "") then
from_date = dtoc(date())
end if
if (to_date = "") then
to_date = dtoc(date())
end if
if (ctod(from_date) > ctod(to_date)) then
goto skip_report
end if
'---------------------
dim filter as C
dim order as C
dim filename as C
filter = "gouallf->date >= " + s_quote(ctod(from_date)) + " .and. gouallf->date <= " + s_quote(ctod(to_date)) + " .and. gouallf->Give_In_Firm = '" + Give_In_Firm + "'"
order = ""
filename = "c:\giveups\ " + "tempreport.pdf"
filename =report.saveas(report,"pdf", filter, order, filename, .f.)
txt = "Account " + Give_In_Firm
rep = "C:\giveups" +alltrim(Give_In_Firm)
dim message as P
message.to = email_address
message.from = "Anis Fakhoury"
message.subject = "Invoice Report for " + to_date + " to " + from_date
message.Attachments = filename
message.message = "Invoice report is attached"
email_send2(message, "afakhoury")
skip_report:
I ran all the lines thru the interactive code, it ran fine, yet from the web page it creates the invoice but doesn't email it.
Any suggestion how to debug this ?
here's the code:
report=alltrim(CurrentForm.Controls.ReportList)
email_address= alltrim(CurrentForm.Controls.email_address)
Give_In_Firm= alltrim(CurrentForm.Controls.Give_In_Firm)
IF eval_valid("email_address") = .f. Then
goto skip_report
end if
IF eval_valid("from_date") = .f. Then
goto skip_report
end if
if eval_valid("to_date") = .f. Then
goto skip_report
end if
'--------------------
if (from_date = "") then
from_date = dtoc(date())
end if
if (to_date = "") then
to_date = dtoc(date())
end if
if (ctod(from_date) > ctod(to_date)) then
goto skip_report
end if
'---------------------
dim filter as C
dim order as C
dim filename as C
filter = "gouallf->date >= " + s_quote(ctod(from_date)) + " .and. gouallf->date <= " + s_quote(ctod(to_date)) + " .and. gouallf->Give_In_Firm = '" + Give_In_Firm + "'"
order = ""
filename = "c:\giveups\ " + "tempreport.pdf"
filename =report.saveas(report,"pdf", filter, order, filename, .f.)
txt = "Account " + Give_In_Firm
rep = "C:\giveups" +alltrim(Give_In_Firm)
dim message as P
message.to = email_address
message.from = "Anis Fakhoury"
message.subject = "Invoice Report for " + to_date + " to " + from_date
message.Attachments = filename
message.message = "Invoice report is attached"
email_send2(message, "afakhoury")
skip_report:
Comment