Is there a way to have FileMaker generate all of theses emails then using the invoice field to track down the associated file that needs to be attached ?
No there is not as you need to attach the PDF at the time you use send mail to create the email. Why do you want to? What problem does that solve for you?
Sorry, that was worded wrong. I need Filemaker to add the file as an attachment to the email that is being sent. I want to send out a batch of emails at a time and each email gets a different attachment. For each record the file name I want attached is the same as the content of one of my fields. Does this clear it up any better?
Is this a PDF that already exists or do you need to first create the PDF before attaching it?
If it already exists, is the PDF stored in a container field?
Either way, you can use a $Path variable when exporting from the container field or saving as PDF to create the PDF. Then you use the same $Path variable in Send mail by clicking the attachment check box and typing in the exact name of the $Path variable with no quotes.
Here's a link on saving as PDF using a $Path variable: Found Sets to PDF with unique file names
And here's a link with a lot more information on $Path variables and how you can use them in scripts: Exploring the use of a $Path Variable in Scripts
Yes this PDF already exists. I do not need Fm to create it. So this might sound stupid but I will give it a shot anyway. For my file path for the attachment could i use something like this?
C:\Users\gambe010\Documents\FileMaker\FM Invoice Data\$filename=expense reimbursement::Invoice Number
This didn't work I already tried it. But I am hoping I am close!
Thank you for the help Phil.
Set Variable [ $FileName ; value: expense reimbursement::Invoice Number ]
Set Variable [$Path ; value: "C:\Users\gambe010\Documents\FileMaker\FM Invoice Data\" & $Filename ]
Set Variable [$Path ; value: "C:\Users\gambe010\Documents\FileMaker\FM Invoice Data\" & expense reimbursement::Invoice Number ]
But this only works on your computer. The file paths will not work if a co-worker opens your database on their computer and tries to do this as the PDF's do not exist on your co-worker's computer. That's one reason to insert the PDF files into container fields with external storage specified.
This worked perfectly! Thank you so much for the help Phil!