Calendar Server sends several types of email messages described in Table 2.7. The format of these messages is controlled by the associated format (.fmt) file listed in the table. Format files are located in specific directories for each local (such as /en for English and /fr for French). These directories are located in the server-root/cal/bin/config directory. For example, the English version of the task alarm message format is specified in the file:
/opt/SUNWicsrv/cal/bin/config/en/mail_todoalarm.fmt
Table 2.7 shows the Calendar Server mail settings stored in server.conf.
Calendar Server generates notification messages by combining a particular event or task with the contents of a format file. The values of data fields within an event or task can be output to the message. The notification message can also include MIME header lines and associated special values. Using special character sequences (format notations), you can include the values of events, tasks, and MIME headers in the message. The lines in the format file are format strings comprised of special character sequences that are replaced with actual values from calendar data fields when the mail message is generated. Special character sequences consist of two characters, the first is the percent sign (%) and the second represents the specific format notation.
The following sections describe special character sequences:
Special Character Sequences for Events
Table 2.8 shows the special character sequences for Calendar Server event notifications.
Date Sub-Formatting
Date-time values can be formatted in many different ways. Using a sub-format, you can provide additional information to describe how a date/time value should be formatted. If a sub-format is not specified, the server uses a default format to output the date. Using a sub-format field allows you to specify the exact format to be used.
For example, %B specifies that the output string includes the event's begin time. This default format prints out the date, time, the time zone, and everything possible about the date. The sub-format string for date values is a strftime format string (see Special Character Sequences for Dates. If you were only interested in the month and year of the start time, instead of %B, you would use: %(%m %Y)B.
Example
The event begins %B%N
The event ends: %(%b %d, %Y %I:%M %p)E%N
The above example produces output that resembles the following notification:
The event begins Feb 02, 1999 23:30:00 GMT Standard Time
The event ends Feb 03, 1999 02:30 AM
Conditional Printing
Sometimes it is desirable to have a line print only under certain conditions. For example, the following lines:
title: %S%N
start: %B%N
end: %E%N
produce output that resembles the following notification:
title: Staff Meeting
start: Feb 04, 1999 09:00:00
end: Feb 04, 1999 10:00:00
There are two conditions, however, where the above example would yield misleading or incorrect results:
In these situations, it is best not to print the end time at all. By default, only the year, month, and day are printed when a time stamp has the attribute of being all-day. Furthermore, if an event start time has the all-day attribute and the event ends on the same day as it starts, a special conditional flag is set. Use the ? modifier to print conditional values only when the special conditional flag is not set.
For example, if you change the lines in the above example to:
title: %S%N
start: %B%N
end: %?E%N
the last line will not be printed for all-day events for which the start day and end day are the same. It produces the following output for typical all-day events (such as birthdays or anniversaries):
title: Staff Meeting
start: Feb 04, 1999
The ? flag can be combined with other modifiers. For example:
The event ends: %?(%b %d, %Y %I:%M %p)E%N
Special Character Sequences for Task Notification
Table 2.9 shows the special character sequences for Calendar Server task notifications.
Special Character Sequences for Dates
Table 2.10 shows the special character sequences for date formatting in Calendar Server notifications.
Note.
The special date format codes appear in this section only for convenience. Calendar Server does not re-write any of the strftime code, but simply uses the operating system implementation.
Simple Event Reminder Example
The following example shows the default event reminder message format:
1 EVENT REMINDER
2 ~~MIME-Version: 1.0%N
3 ~~Content-Type: text/plain; charset=%s%N
4 ~~Content-Transfer-Encoding: %x%N%N
5 Summary: %s%N
6 Start: %(%a, %d %b %Y %I:%M %p)B%N
7 End: (%a, %d %b %Y %I:%M %p)E%N
8 Location: %L%N%N
9 Description: %N%d%N
Line 1 is the message subject.
Line 2 begins with ~~ which indicates that it is a MIME wrapper line. That is, the replacement of special character sequences are those associated with an internal MIME object rather than an event or task. The special sequence %N is a line feed. The subject line does not need the special new line sequence, while all other lines do.
Line 3 is also a MIME header line. It contains the special character sequence %s which will be replaced by the character set associated with the event or task being mailed.
Line 4 is the last MIME line, %x is the content transfer encoding string needed for this message.
Line 5 lists the event summary and calls out the event summary with %s.
Line 6 lists the event start time. It makes use of a sub-format string on the special character sequence %B. For details, see Date Sub-Formatting.
Line 7 lists the event end time.
Line 8 lists the location of the event.
Line 9 lists the description of the event.
The following sample resembles the notification message generated by the above example:
From: jsmith@airius.com (James Smith)
Date: Wed, 15 Nov 1999 19:13:49
To: jsmith@airius.com
Subject: EVENT REMINDER
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Summary: smtp_rig event 1
Start: Tues, 16 Nov 1999 02:00 PM
End: Tues, 16 Nov 1999 03:00 PM
Location: Green Conference Room
Description:
This is the description for a randomly generated event.
Complex Event Reminder Example
The following example shows a more complex multipart message. It has a human-readable text part and an IMIP PUBLISH part.
EVENT PUBLICATION
~~MIME-Version: 1.0%N
~~Content-Type: multipart/mixed; boundary="%b"%N%N
This is a multi-part message in MIME format.%N
~~--%b%N
~~Content-Type: text/plain; charset=%s%N
~~Content-Transfer-Encoding: %x%N%N
Summary: %s%N
Start: %(%a, %d %b %Y %I:%M %p)B%N
End: %(%a, %d %b %Y %I:%M %p)E%N
Location: %L%N%N
Description: %N%d%N%N
~~--%b%N
~~Content-Type: text/calendar; method=%m; component=%c; charset=%s%N
~~Content-Transfer-Encoding: %x%N%N
BEGIN:VCALENDAR%N
PRODID:-//iPlanet/Calendar Hosting Server//EN%N
METHOD:PUBLISH%N
VERSION:2.0%N
BEGIN:VEVENT%N
ORGANIZER:%K%N
DTSTAMP:%Zn%N
DTSTART:%ZB%N
DTEND:%ZE%N
SUMMARY:%s%N
UID:%U%N
%R
%A
%a
%e
%l
SEQUENCE:%S%N
LOCATION:%L%N
GEO:%G%N
%F
STATUS:%t%N
END:VEVENT%N
END:VCALENDAR%N
~~--%b--