Vaughan Posted February 15, 2001 Share Posted February 15, 2001 The "Send Mail" script step in FileMaker Pro 4.x is extremely useful, but FMP does not send the mail itself: it passes the message onto the default mail client program on the machine that is running the script. Unfortunately for Macintosh users, the only mail client software FMP4.x works with is Eudora and Claris Emailer. However there is a work-around that uses the "Open URL" script step and the "mailto:" URL type. The mailto: string can contain subject and body information as well as the recipient address. The Open URL script step passes the data onto the computer's default web browser instead of the email client. It'll work as long as the web browser can send mailto: messages. This includes Netscape Navigator but currently excludes Internet Explorer (but check it yourself, things change quickly). To make the magic happen, create a calculation text field that joins up all of the recipient, subject and body data into one long text string... "mailto:" & emailfield & "?subject=" & subjectfield & "&body=" & bodyfield ...where "emailfield" etc are fields in the database with the relevant information. Cc fields can also be specified: use the syntax "?cc=" but only include it if you have a Cc recipient. A case statement would take care of that: Case(not IsEmpty(ccfield), "?cc=" & ccfield) Note that because the subject and body fields will have some HTTP reserved characters in them (like <, >, &, spaces etc) they need to be "converted" into their http equivilents -- an easy task with the External("Web-ToHTTP", field) function. In this case the calculation will look like: "mailto:" & emailfield & "?subject=" & External("Web-ToHTTP", subjectfield) & "&body=" & External("Web-ToHTTP", bodyfield) OK we have the calculation text field done. Define a script that finds and sorts the records etc, and use the step "Open URL" based on the calculation field just created. There are limitations to this method however: attachments won't work, and messages get queued in your email client, not sent immediately. ----- Update. Arrrrggghhhh! The External("Web-ToHTTP") function is only available if the Web Companion plug-in is enabled. It probably won't be on client machines, in which case the Open URL step will create a new email message in the browser but the subject and body text won't appear. There are two solutions: activate the WC plugin on all client machines (very undesirable, can cause port conflicts and open up security holes) or use the Substitute() function instead -- no downsides other than it's less elegant. The Substitute() function requires hard-coding each text string equivilent individually, by nesting a separate Substitute function for each string -- a lot of work to do each posible equivilent. However for my application I found that just two substitutions -- space=%20, carriage return=%0d -- was enough for my purpose. The calculation that I used with the Substitution() function looked like this: "mailto:" & Emailfield & "?subject=" & Substitute(Substitute(subjectfield, " ", "%20"), " Link to comment Share on other sites More sharing options...
This topic is 8071 days old. Please don't post here. Open a new topic instead.
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
Already have an account? Sign in here.Sign In Now