February 8, 200619 yr I have a very particular problem with a client who is using Outlook. When I script to create an email (but not have the email sent without dialogue), my users must actually send the email before they can either return to Filemaker or do anything else in Outlook. I don't, however, experience the same problem on my Mac with Mail. (And the Outlook users can create messages, keep them open, and do other things in Outlook normally.) What is going on, and how do I fix it? Has anybody else had this problem? (Oftentimes people will need to do other things before sending the mail.)
February 8, 200619 yr I asked this very same question to Bill Heizer of FileMaker and he said it's not FileMaker that forces that behavior, but rather the Windows MAPI interface. Not the answer I was hoping for either.
February 8, 200619 yr Here is how you fix that problem. First thing; don't use Send Mail. Use Send Event instead. Use Send Event with a calculation something like this: "mailto:" & Table::Email_Address & "?Subject=" & Substitute ( Table::Subject; " "; "%20" ) I the example above I assume that you have two fields: Table::Email_Address Table::Subject What the calculation does is prepend "mailto:" to the email address and then makes the subject equal to the value contained in the Subject field. The Substitute function replaces any spaces in the subject line with the character string "%20" (without the quotes) which is necessary because the "mailto" syntax chokes on spaces. The benefit is that Filemaker just creates a new email message with the address and subject populated and then passes control back to the user as you would expect. The other advantage is that the user's default signature will come in too. Something that doesn't happen when using Filemaker's Send Mail.
February 9, 200619 yr Author OK, that makes sense. But I'm a little thick -- how do you write script for the "send event" to first create the new message (before fields are filled in)?
February 9, 200619 yr Steverino, I assume you have a contacts database or something like that which contains email addresses. And I assume that you just want to send an email to a single recipient and you may or may not know the subject. If this is the case then the script need only have 1 step. Just use Send Event with a calculation like the one listed above. To see it in action without using Filemaker at all simply choose: Start > Run (on Windows) Then type: mailto:[email protected] and press Enter. This should have created a new message with John Doe as the recipient. This could be made simpler with a custom function. Maybe I'll work on that and if successful I'll post it later.
February 9, 200619 yr Okay here is a custom function. Name: MailTo Parameters: addr subject ----- Function Start ----- Let ( [ addr = Trim ( Substitute ( addr; "¶"; ";" ) ); addr = Substitute ( addr; " "; ";"); addr = Substitute ( addr; ","; ";" ); subject = If ( IsEmpty ( subject ); ""; "?subject=" & Trim ( Substitute ( subject; " "; "%20") ) ) ]; "mailto:" & addr & subject ) /* Use in conjunction with Send Event to overcome the inability of Filemaker's Send Mail command to relinquish control of the PC back to the user until after the message has been sent. Will recognize commas, spaces or CRs as address separators. Only tested on Windows XP and Outlook 2003 (Standard) */ ----- Function End ----- To use this function simply use Send Event with this calculation: MailTo ( addr; subject )
April 10, 200619 yr Author I'm just getting back to this. Haven't tried this solution on Windows, but it doesn't create a new message on a Mac. I can use AppleScript, but I'm not sure how to deal with the quotation marks in my calculation.
April 11, 200619 yr Author I realize now that I just need to indicate quotation marks with " and that I also need to separate command lines with ¶ (the Paragraph sign). Still figuring out attachments, and getting the script to work with Entourage.
Create an account or sign in to comment