Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Sending an email when a new record has been enterd


This topic is 7454 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

A couple ways to do this, depending on how much you want to do. The easy way is to use the Send Mail script step when a new record is processed. The problem with this is it relies on the client computer having an email program set up; it uses the email client to send the message.

Another way: If you have a spare computer sitting around, you can set it up with FMP client and run a special script in an infinate loop (with a short pause) that checks for new records, when it finds some, it sends a message (you could send a message for each record.) This could use the Send Mail script step with the email client on the machine setup for this, or you could use a third party plug-in, like "mailit" to send the message through the plug-in. I use a setup like this to send notifications when new employees are added or when employees are terminated. I just have to make sure the loop on the dedicated machine is started up again after I take the databases down for maintenance.

Posted

A couple options:

If you need the email sent immediately on each record creation, you could prevent the user from creating records directly, and instead offer a record creation script, using special global fields to hold the values for each field. Having such a script has other benefits (such as preventing the mess of semi-finished new records cluttering the database). But in this case the main benefit would be that after going to the layout with the globals and pausing for data entry of the initial profile for the record, there could be a button that continues the script and includes a SendMail script step just after creating the record (Setting the fields according to the globals), but before clearing out those global dummy fields...

Are you clear with SendMail script step in general?

If a daily update email is better -- and if the database opens and closes daily -- a startup script checking for recent additions (according to a record create date field) might be more efficient.

  • Newbies
Posted

I have the email setup on the clients machine and i am able to send the message but i am not sure on how to trigger the email when the new record is processed

Posted

You would need to script navigation, record creation, and record processing for this to work well, creating buttons attached to scripts to do all this. This means locking out menus for the users' passwords. Otherwise users can create records and ignore your process buttons.

This is how much of my record creation is handled: Give the users use navigation to go from one place to another and process buttons to make changes to certain types of records.

Posted

Howdy! I'm not sure, but I think there are plug-ins that do this, too. If records were being made via the web, you could use [FMP-mail...] tags.

If you use scripts as Ender and ESpringer recommend, you can also use calcs to validate that the message has been sent. Just in case, we have MailSentDate and MailSentTime fields, too, so we can know when the message went out (sometimes we must resend and it is different from the creation date).

--ST

Posted

Apologies if I shouldn't post here but the topic seemed appropriate, and I couldn't find an answer from searching.

I have a web hosted database. Users create new records via a CDML form. I want to send out an email when a new record is entered.

I have added

<INPUT TYPE=hidden NAME="-mailto" VALUE="[email protected]">

and the other associated -mailcc, -mailhost, -mailformat, -mailfrom, -mailsub etc. commands and it works fine.

However I really want the email sent to a field ('email address') within that record so changed it to

<INPUT TYPE=hidden NAME="-mailto" VALUE="[FMP-field: email address]">

but it doesn't work i.e. no mail gets sent.

Does anybody have any ideas why this might be? I've spent far too long on this issue!

I note the CDML Reference database only lists static email addresses in its examples, so perhaps dynamic addresses can not be used with -mailto? Having said that my mailformat file includes dynamic information ok.

The other thing is that the field 'email address' is a look-up field (based on the values entered in the new record). Could that be making the difference?

Thanks, Gary

Posted

What if you add quotes around email address, since it has a space in the name?

Posted

Hi, Gary! You can use a field for TO: line... it does not have to be a hard coded address. FMWebSchools has detailed instructions on how to do this in their FAQ...

http://www.fmwebschool.com/FAQ.htm#AutomaticEmail

I think you will find it helpful. For whatever reason, I have found working with the -mail tags to be frustrating at times. I have compared a working model to a non-working model side-by-side and sometimes not seen any differences and yet one works and the other does not. There is also no notification of a bounce so sometimes you're waiting for a message to see if your solution worked and you don't know how long to wait before deciding it did not work... then an hour later your message comes in and you wonder which one that was from. I also avoid COPY/PASTE, too, when I work with -mail tags... I key the code in myself.

I now try to include date/time in each test and I serial number them somehow (usally apple, bedlam, cork, dusty, etc.) and/or include a short description of what the message was.

Yep, I'm properly paranoid about -mail tags now, but they DO work. The only problem I had I did not eventually solve involved an IF statement, and now I can't even remember what I was doing...

--ST

P.S. One more warning about FMP -mail tags... My e-mail client intially guessed that my FMP-generated messages were SPAM, so I did not even realize that the messages were successfully arriving until I checked my SPAM folder and told it "Hey, that's not junk mail! Don't do that anymore!" It's behaved ever since.

Posted

Thanks for the helpful responses.

Steve, the fmwebschool is indeed a useful site - now bookmarked!

I have employed method 2 (redirected url, with all the mail commands in the url) as detailed there and it seems to now be working ok. Something to watch for is spaces in the name of your layout or your mail subject. Replace them with %20 in the url or you get an unhelpful error 4 message.

I considered method 1 but I'm not familiar with the required e-mail clients and was unimpressed by a quick look at Emailer.

I'm still not sure why my original technique did not work though.

fmwebschool says "You can't simply include the CDML mail tags on your new record submit page since the record hasn't been created yet, you don't have access to the visitor's email address."

I don't understand this, because when I tried (with a static email address) my -mailformat file included dynamic information that the user had entered and this was getting mailed ok. My experience suggests access to data in the new record is possible at this stage.

In response to Queue I don't think it matters if you have spaces in the field names. Most of my fields do and everything else seems to work ok. Extra quotes may confuse the INPUT Tag?

Thanks, Gary

Posted

Howdy! I believe FileMaker Pro relies upon your computer's default preferred e-mail and web browser settings. In Mac OS 9, there was an Internet control panel where you could set default e-mail application, web browser, home page, etc.

In 10.2, I think it was accessible via System Preferences and Safari Preferences.

In 10.3, you have to run Safari to change default web browsers and run Mail to change your default e-mail client... both are under Preferences... kinda sneaky if you ask me.

--ST

This topic is 7454 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

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.