Jump to content

send email when new record is added


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

Recommended Posts

  • Newbies

I'd like to automatically send an email when a new record is entered via CWP.

Here's the situation. Student information system. Teachers can enter a discipline referral for a student via CWP, and the office needs to know that it's been entered.

How can I trigger such an email.

thanks in advance for any help or advice.

Link to comment
Share on other sites

We usually have PHP run a script that creates an activity record of type email and then a server script sends the queued activity emails using 360works email.

Edited by Guest
Link to comment
Share on other sites

  • Newbies

Thanks for the reply. I don't know what you mean by an activity record of type email....

however, I have implemented a server side script that checks for new referrals hourly. Maybe that will work well enough.

Link to comment
Share on other sites

Ken,

The "Send Mail" (via SMTP server) script step is server compatible; when the Teacher enters the referral, the PHP script could perform a script in the database that sends an email.

(I haven't done this, but I think that should work)

We usually have PHP run a script that creates an activity record of type email...

Out of curiosity, what other record types do you keep in the activity table? I'm surprised to hear you don't have a separate table for email records. (unless I just miss-interpreted what you were saying)

Link to comment
Share on other sites

Hi. Over the years we've ended up with a table we call "Activities" in most of our systems. We also have a table of Activity Categories, ACTCATs, and each Activity record is given an ActCatID. In the ActCat table we have flag_email, flag_letter, etc.

So, when a script creates an activity record it is assigned an ActCatID. Looking thru the relationship to ActCat, each Activity knows what "type" it is. An Activity of type "email" that is queued (DateSent is empty) is found by a server script and sent. We use 360email bcs we support html, inline graphics and multiple attachments.

As for ActCat names, they are specific to the system and often mimic biz process milestones. For example, "Confirmation Sent," "Appointment Confirmed." We also have simply, "Note," a catch all Activity.

Looking at a portal of activities lets a user see the chain of events that have occurred so far for that client.

Link to comment
Share on other sites

So does one table hold emails, letters, and notes? If so, do you have separate fields for each of these, or do you use any of the fields in all areas. (I can see how the field used for the message body could be the main data field for a letter or a note.)

Thanks for sharing by the way, it's always fun to hear how other people do things. It's too easy to fall into a "rut" of thinking how I do something is the only way to do it.

by the way Ken,

I think you are already using a similar method as bcooney suggested.

Link to comment
Share on other sites

Yes, Dan, one table holds all emails, ltrs and notes, and the Body field is used across all types, just as you surmised. We have dedicated Email_To, Email_From and Email_ReplyTo fields.

I think the primary advantage of creating a record that IS the email that goes out, Ken, is that you retain the data in the system. If you simply find records that are in a state that "needs" an email and loop thru them sending an email without creating an email record, then there is no evidence of the email in the system. You don't need a plugin to do this, btw.

Link to comment
Share on other sites

  • Newbies

Thanks for the additional information...

I think what you have is not only a log of what happened,but the details (content) of what happened. a very nice "paper" trail.

we'll see how well this notification system works, as we are back at school today. :(

Link to comment
Share on other sites

This topic is 4926 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.