I'm not 100% certain, but I don't believe script triggers will function via PHP code. From the Help file:
In Instant Web Publishing and Custom Web Publishing, script triggers can only be activated by a script and not by direct user interaction. For example, if a user tabs into a field that has an OnObjectEnter script trigger, the trigger will not activate. If a script step causes focus to move into that field, the script trigger will activate.
To do what you want, one approach would be a server-side or robot script that searches for new records and sends out the emails on a periodic basis. You could have a field that sets a flag with an auto-enter calc on a new record, then have the email script clear it when it's done. (Or vice versa.)
Another option would be to play around with the setScript() method. The documentation says it's supposed to work after a Find command, but maybe it works after an Add command as well (it's attached to the Command class and the docs say the Add command inherits it, so ... maybe?). I've not tried it, but it might be worth a go.
If you have access to the PHP code, you can handle this at the source, using PHP's ability to send the email. It's really easy. Here's an example of how to call the PHP function:
$to = 'firstname.lastname@example.org';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: email@example.com' . "\r\n" .
'Reply-To: firstname.lastname@example.org' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
Here's a link to the PHP documentation:
If you are using cwp with php, you have a filemaker server!
So, you can create a server script that run every minute and trigger this function!
Inviato da iPhone!
I would follow Morgan's advice. After you create the record in php, send an email with php. I generally use the htmlMimeMail5 class or PHPMailer class for sending mail in php. Using one of the classes may make smtp authentication a little easier depending on your mail settings.
You can have the php trigger a filemaker script that will run. I use this all the time to send an email after a lead comes in via the web page. I use dreamweaver with FM plug in. The code looks like this
$FormAction_result = $FormAction_add->execute();