Email

model.TestEmail
Return type:boolean

Set this to True to cause all emails sent during the script to go to the currently logged in user’s email.:

model.TestEmail = True
model.Transactional

Prevents sending notices about emails having been sent:

model.Transactional = True
model.ContentForDate(file, date)
Returns:

The HTML content for a particular date ready to be used for an email.

Return type:

str

Parameters:
  • file (str) – The name of the HTML content
  • date (date) – The date to search for the associated content.

This function is for a very special purpose. Bellevue sends out a daily devotional email that people can subscribe to. The content for each day’s email is stored in a large Special Content > HTML file. All the days are stored in the same file, separated by markers that indicate the start of a particular day.

The day marker is contained in an <h1> header and looks like:

<h1>
  2/27/2016==============================
</h1>
<p>content of email here...

This function looks for that pattern <h1>m/d/yyyy=======</h1>. Once it finds that for the date specified, it returns the rest of the content up until the next marker or end of file.

model.Email*(query, queuedby, from, name, ...)
Parameters:
  • query (str) – See The Query Parameter
  • queuedby (int) – The PeopleId of the coordinator’s email address who is emailing on behalf of sender name
  • from (str) – The from email address
  • name (str) – The sender’s name

This is the pattern for all of the following functions. Each one takes these first four parameters and are different only in the remaining parameters beyond the first four.

model.Email(query, queuedby, from, name, subject, body, *cclist)
Parameters:
  • subject (str) – The subject of the email (overrides the subject in the special content)
  • body (str) – The message content of the email.
  • cclist (str) – *optional default=None. A comma separated list of email addresses.

Sends an email to a list of people in a query passing in both subject and body of the email.

model.EmailContent(query, queuedby, from, name, file)
Parameters:file (str) – The name of the special content holding the message body and subject

Sends an email to a list of people in a query based on saved content.

model.EmailContentWithSubject(query, queuedby, from, name, subject, file, *cclist)
Parameters:
  • subject (str) – The subject of the email (overrides the subject in the special content)
  • file (str) – The name of the special content holding the message body and subject
  • cclist (str) – *optional default=None. A comma separated list of email addresses.

Sends an email to a list of people in a query based on saved content, but also allows you to specify subject.

model.EmailReminders(orgid)
Parameters:orgid (int) – The id of the Organization to email reminders for.

This function will email reminders for an organization that utilizes them.

If the organization is a ChooseVolunteerTimes type of organization, it will send volunteer reminders of those who are scheduled to work in the next 7 days.

Otherwise, if the organization has an Online Registration and there is a Reminder Email setup on the Messages tab, then the reminders for the event will be sent.

model.EmailReport(query, queuedby, from, name, subject, report)
Parameters:
  • subject (str) – The subject for the email.
  • report (str) – The name of the Python script to run to get the body of the email.

This is useful for sending a user generated statistics report periodically to leaders.

model.EmailReport(query, queuedby, from, name, subject, report, query2, query2title)
Parameters:
  • subject (str) – The subject for the email.
  • report (str) – The name of the Python script to run to get the body of the email.
  • query2 (str) – Another query which can be used inside the report script.
  • query2title (str) – The title for the query to be run inside the report script.

This is the same as previous, except that you can use the same script but pass in another query to generate custom content based on that passed query. The previous version of EmailReport required you to embed the query name in the Python script. This version of the function permits you to have a generic Python script and then call it multiple times with a different query and description each time.

The query2 is available to the report script as Data.QueryName. The title of the query2 is available to the report script as Data.QueryDescription.

model.EmailStr(body)
Parameters:body (str) – The content of the email to be processed.

This will process body through our EmailReplacements code. The person to be used to generate replacements will be the currently logged in user.

This is useful for testing a script generated email to see how it will look.

© 2019 TouchPoint Software, LLC.  All rights reserved.