Newbies JonRb Posted October 1, 2004 Newbies Posted October 1, 2004 I've looked through the past posts and haven't seen anything really trying to do what I need to get done. I've already got a page that makes heavy use of javascript to construct and then send a URL with the filemaker query to create new records and populate the fields. What I need to do is then have an email be automatically sent to the submitter. I've tried doing this from the HTML/javascript end, but this only opens up an email on the client's machine. I want my server (running FMServer Advanced) to send the email automatically. The send mail script is listed as not compatible with the web, but I don't realyl get why this has to be the case. When the query is sent, the script should run on the server end, not the client. In my setup the client actually never sees anything from FM- the returned XML is dumped somewhere. Just tacking on &-script=email at the end of my string doesn't work. When I run the script manually on the server, it does the trick, I don't want to have to run a daily sweep for new records to email. The server runs 24/7, so a daily onload isn't feasible either. Nor is having the server, or another machine, constantly loop looking to send emails to new records. So is there any way around this on the FM side? Anyone know of something I could with java to generate an email without actually calling up an email client on the client's end?
Steve T. Posted October 11, 2004 Posted October 11, 2004 Hi, J! FM7AS is new and does not support the -mail CDML tags that we used to use in FM4-6. FM7 has improved web-enabled scripts, but it has always had a problem w/them because of single- vs. multi- threadedness. I do not have FM7 and I do not really know much about this, but my guess is that the script can only be executed by 1 user at a time, so if you have near-simultaneous submissions, it's possible that only 1 user will have the e-mail script execute and the other will have the script fail because it was in use by another user. I do not know JavaScript, but PHP can do mail functions very easily. I'm not sure if you want to go down that road or not, but if you do, Apache is pre-installed in your OS X and Marc Liyanage http://www.entropy.ch has a PHP installer (and instructions) you can use if PHP is not pre-installed already. If you are serving w/FM on port 80 already (:80), you'll have to also change the port for Apache to use so it does not conflict. :8080 is a good choice and is a common alternate web port. --ST
Newbies xardoz Posted November 4, 2004 Newbies Posted November 4, 2004 Hi Steve, I'm having the same issue. I'm going to install Apache and PHP on my Win98 box (with FMP 6 Unlimited). I'm currently accessing the database by HTML forms that reside in FMP's WEB directory. These forms were created by the CDML Tool I downloaded from somewhere. I can create a PHP form that will email results from a MySQL search, but I've never done this with FMP. I work tech support for a school district, and we'd like our tech support guys to be able to enter repair request tickets via the my HTML pages in the classroom, then hit a button that would cause the FMP server to email (not the local client) the repair ticket info to the teacher. Do you have any suggestions or sample code I can use as a tutorial? Thanks!
Steve T. Posted November 5, 2004 Posted November 5, 2004 Howdy, xardoz! Got your PM invite to participate in this thread again... I probably would not have seen your post otherwise, since I don't do much FM e-mail (is that a goblin dragon die I see?). Nevertheless, here's what I'd suggest off the top of my head... hope it helps... myserver.myschool.fmusd.mystate.us repairjobs.fp5 repairticket.html > confirmandmail.html > thankyou.html The 1st page lets someone complete a repair ticket. The 2nd page shows the info entered and sends mail message when submitted. message.txt contains [FMP-field:whatever] fields and whatever info should be sent The 3rd page just follows-up; if there will be mutiple entries, you can make the -format page repairticket.html again instead of thankyou.html so the user can immediately create another repair ticket. repairticket.html <form name="ticketform" action="FMPro" method="post"> <input type="hidden" name="-db" value="repairjobs.fp5"> <input type="hidden" name="-format" value="confirmandmail.html"> ... your fields/inputs ... <input type="submit" name="-new" value="CREATE TICKET"> </form> confirmandmail.html <form name="mailform" action="FMPro" method="post"> <INPUT TYPE="hidden" NAME="-db" VALUE="repairjobs.fp5"> <INPUT TYPE="hidden" NAME="-format" VALUE="thankyou.html"> <INPUT TYPE="hidden" NAME="-recID" VALUE="[FMP-CurrentRecID]"> <INPUT TYPE="hidden" NAME="-MailHost" VALUE="smtp.mycompany.com"> <INPUT TYPE="hidden" NAME="-MailFrom" VALUE="[email protected]"> <INPUT TYPE="hidden" NAME="-MailTo" VALUE="[email protected]"> <INPUT TYPE="hidden" NAME="-MailCC" VALUE="[email protected]"> <INPUT TYPE="hidden" NAME="-MailSub" VALUE="REPAIR TICKET - [FMP-field:teachername]"> <INPUT TYPE="hidden" NAME="-MailFormat" VALUE="message.txt"> <INPUT TYPE="submit" NAME="-find" VALUE="Mail this to [FMP-field:teachername]"> </form> thankyou.html <h2><center>JOB TICKET ENTERED. COPY MAILED TO TEACHER.</center></h2> It was taking me too long so I copy/pasted from one of my actual solutions; hence, the MIXED CASE but case should have no significance. Also, I may have missed something so you may have to refer to the CDML reference db still. Post any fixes here for whomever should follow, though. Thanxalot! --ST
Newbies xardoz Posted November 5, 2004 Newbies Posted November 5, 2004 super cool! Thanks, this will help a lot!
Newbies xardoz Posted November 5, 2004 Newbies Posted November 5, 2004 <INPUT TYPE="hidden" NAME="-MailFormat" VALUE="message.txt"> Hi, One more question: How is message.txt being generated? I want the body of the email to contain the info from the various fields - how do I get a CDML/HTML page to dump that into message.txt? Thanks again!
Steve T. Posted November 5, 2004 Posted November 5, 2004 Howdy, X! message.txt is just a plain text file you can create manually in any word processor or text editor, just make sure the file format is TEXT and that it is in the same web-published folder as the page referring to it. This text file is used for the body of your message and can contain CDML tags/fields, so it could have something like... ------------- Dear [FMP-field:teachername] We have received your service request #[FMP-field:jobid] and will be working on it very soon. Additional details we have recorded are as follows... [FMP-field:ticketdate] [FMP-field:teachername] [FMP-field:description] Thank you. _________________________________ I think I based this on earlier posts by Vaughan. If you need to do any more research, Vaughan's post may help quite a bit. I also remember FMWEBSCHOOLS having some helpful info in their tutorials, but I'm not sure if it's still there since FM7's removal of CDML. --ST
Recommended Posts
This topic is 7315 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 accountSign in
Already have an account? Sign in here.
Sign In Now