Skip to main content
Inspiring
September 4, 2008
Answered

cfmail - once a day

  • September 4, 2008
  • 3 replies
  • 584 views
I have a simple calendar tool I built for my wife's yoga studio.
It's for the volunteer schedule.

A person is assigned to a shift.
If they can not work on that shift, they click a small x next to their name and the shift is indicated as vacant and an email is sent to all other volunteers letting them know that shift is now available.

The problem is that about 80,000 were sent last month, and I went way over my shared plans limit. 🙂 So this tool I built for her for free, and let the studio keep on my site, is costing me money. How'd that happen? :)

Anyhow, before I implement a workaround, possibly sending email once a day in a batch to each user, does anyone have suggestions for a process to help reduce the total number of email sent?
    This topic has been closed for replies.
    Correct answer Dan_Bracuk
    Talk to your hosting company about scheduled jobs. If they won't let you do it on the administrator, use cfschedule.

    Hopefully your db design allows you to identify vacant shifts. If so, your scheduled job is a simple cfquery/cfmail.

    To minimize the number of e-mails, don't use the query attribute in cfmail. Use cfloop in the mail body part instead.

    3 replies

    ctreevesAuthor
    Inspiring
    September 4, 2008
    Ian,
    Each outgoing email from each email account goes toward my total of 100,000 per month.

    Dan,
    I think the idea of looking through the database for vacant shifts and send those once a day is perfect. The host has an admin panel where I can schedule up to 5 tasks. I work around that by making 1 page with many cfincludes for the tasks I want run. :)

    Thanks for the suggestions. I was going to do something foolish like write the "emails" to the database to be sent at the end of the day, but now I'll look for vacant shifts and send the email that way.
    Dan_BracukCorrect answer
    Inspiring
    September 4, 2008
    Talk to your hosting company about scheduled jobs. If they won't let you do it on the administrator, use cfschedule.

    Hopefully your db design allows you to identify vacant shifts. If so, your scheduled job is a simple cfquery/cfmail.

    To minimize the number of e-mails, don't use the query attribute in cfmail. Use cfloop in the mail body part instead.
    ctreevesAuthor
    Inspiring
    September 4, 2008
    quote:

    Originally posted by: Dan Bracuk
    To minimize the number of e-mails, don't use the query attribute in cfmail. Use cfloop in the mail body part instead.


    I am curious about this idea.

    If the vacancy was to be sent to 10 people, and I use cfmail with a query it sends 10 email. If I do it with cfloop, it still sends the 10 email, but the mailserver will only recognize it as 1 email?
    Inspiring
    September 4, 2008
    quote:

    Originally posted by: ctreeves
    quote:

    Originally posted by: Dan Bracuk
    To minimize the number of e-mails, don't use the query attribute in cfmail. Use cfloop in the mail body part instead.


    I am curious about this idea.

    If the vacancy was to be sent to 10 people, and I use cfmail with a query it sends 10 email. If I do it with cfloop, it still sends the 10 email, but the mailserver will only recognize it as 1 email?

    No. The reason for the suggestion was in the event of mulitple vacancies. Instead of sending one email per vacancy, you send one with all the vacancies.

    Regarding this:
    I work around that by making 1 page with many cfincludes for the tasks I want run. :)

    use cftry/cfcatch so that if one job fails the others still run.


    Inspiring
    September 4, 2008
    ctreeves wrote:
    > I have a simple calendar tool I built for my wife's yoga studio.
    > It's for the volunteer schedule.
    >
    > A person is assigned to a shift.
    > If they can not work on that shift, they click a small x next to their name
    > and the shift is indicated as vacant and an email is sent to all other
    > volunteers letting them know that shift is now available.
    >
    > The problem is that about 80,000 were sent last month, and I went way over my
    > shared plans limit. :) So this tool I built for her for free, and let the
    > studio keep on my site, is costing me money. How'd that happen? :)
    >
    > Anyhow, before I implement a workaround, possibly sending email once a day in
    > a batch to each user, does anyone have suggestions for a process to help reduce
    > the total number of email sent?
    >


    Well first of all I think sending out the emails less often is great for
    the users as well as you. I suspect more the one 'volunteer' may have
    been putout by receiving dozens of largely repetitive mails.

    Other then the once a day plan (or whatever schedule is workable) what
    about combining emails? Does your plan count how many mails you send
    differently if you send many mails to one person or one mail to many
    persons?

    I.E.
    Is this-
    To: Joe Smith
    ...
    To: Jane Smith
    ...
    To: Will Smith

    Different from-
    To: Joe Smith; Jane Smith; Will Smith