Jump to content
Sign in to follow this  

Sending Emails and saving PDF files

Recommended Posts

Hi there,

While I am working my script, I am using the loop function to generate my end-of-month balance sheet for my customers. I therefore list in Preview mode the summary of all the invoices each customer ows me. This can only be done in preview mode since I utilize the summary and total function to add up the invoice amounts. Once the first page is generated, I a save it to PDF under a filename (I have already tried to save it as a $variable but the problem did not go away!).

Next, I want to send the saved PDF file to my customer via mail. So I do a "Send Mail" and specify the email address which is strored in the current field's record. The Problem, is that Filemaker does not want to read that email address. As far as I am concerned it's because I am still in Preview mode! However, if I insert just before the Send Mail, a "Enter Browse mode", it does not change the problem.


Go to Record/Request/Page


Enter Preview Mode

Save Records as PDF [ File Name: filewin:/D:/Releve de compte FEDEX.pdf ; Records being browsed ]

Enter Browse Mode

Set Field [ GACPPT-EXPORT::SMTP Setup Return; SMTPit_Clear &

SMTPit_SetTo( ${GACPPT-EXPORT}???:Client Email; SMTPit_Append ) &

SMTPit_SetSubject( ${GACPPT-EXPORT}???:SMTP Email Header; SMTPit_Append ) &

SMTPit_SetBody( ${GACPPT-EXPORT}::SMTP Email Message; "Text"; SMTPit_Append ) &

SMTPit_SetAttachment( "d:Releve de compte FEDEX.pdf" ; SMTPit_Append ) &

SMTPit_Send ]

Go to Record/Request/Page[ Next; Exit after last ]

End Loop

(Note: The SMTPit doesn't change much. It simply is a different way of sending a Mail just like "Send Mail" from FM9Pro

The outcome here, are various different emails with the correct PDF attached file, yet the destination email address is always the same. It's as though Filemaker,take the stored email address of the first record and does NOT continue along!

Any ideas? I can't find the solution!!!



Edited by Guest

Share this post

Link to post
Share on other sites

Welcome TriMan!


1. Are you looping thru Customers? Seems like you are looping thru invoices. I believe that you should be looping thru Customers, and gtrr Invoices using the layout for the PDF.

In Customers (possibly found set)


if related Invoices

gtrr invoices, report layout

sort for subsummary report?

set $export path {I'd use the Get (temporarypath) & filename.pdf}

go to layout Customers //back to customers

Send Mail

next rec, exit after last

End Loop

I see $var in your SMTPit_SetTo statement. When are these set?

Edited by Guest

Share this post

Link to post
Share on other sites

Hi bcooney,

Thank you for your thoughts. I never worked previously with gtrr and now thanks to you I am trying out this function. I rethought my way of working and still have a problem.

If I lauch a gtrr from my customer list, the how can I create a list that gives me a list of all the related records for that customer but ALSO for a time periode. The gtrr will generate a list of all the invoices from my customer that's great ... but now how do I then add a "find criteria" to also include the time period from for example 04/01/2009 ... 04/30/2009?

Thanks so much for your help!

Edited by Guest

Share this post

Link to post
Share on other sites

You need a relationship from Customer to Invoices that has multiple predicates.

In Customers, create two global fields gDateStart and gDateEnd.

Then, build a relationship from Customer to Invoices that matches:

CustomerID and

gDateStart <= InvoiceDate and

gDateEnd >= InvoiceDate

Populate the two gDate fields with values and use this relationship in the gtrr to find all invoices for the customer for the given date range. You could also include a filter for balance due...

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

By using this site, you agree to our Terms of Use.