.\" Generated by scdoc 1.11.2 .\" Complete documentation for this program is not available as a GNU info page .ie \n(.g .ds Aq \(aq .el .ds Aq ' .nh .ad l .\" Begin generated content: .TH "AERC-TEMPLATES" "7" "2023-04-23" .P .SH NAME .P aerc-templates - template file specification for \fBaerc\fR(1) .P .SH SYNOPSIS .P aerc uses the go text/template package for the template parsing.\& Refer to the go text/template documentation for the general syntax.\& .P Template files are composed of headers, followed by a newline, followed by the body text.\& .P Example: .P .nf .RS 4 X-Clacks-Overhead: GNU Terry Pratchett Hello, Greetings, Chuck .fi .RE .P If you have a template that doesn'\&t add any header, it \fBmust\fR be preceded by a newline, to avoid parsing parts of the body as header text.\& .P All headers defined in the template will have precedence over any headers that are initialized by aerc (e.\&g.\& Subject, To, From, Cc) when composing a new message, forwarding or replying.\& .P .SH MESSAGE DATA .P The following data can be used in templates.\& Though they are not all available always.\& .P \fBAddresses\fR .RS 4 An array of mail.\&Address.\& That can be used to add sender or recipient names to the template.\& .P .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} \fIFrom\fR: List of senders.\& .RE .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} \fITo\fR: List of To recipients.\& Not always Available.\& .RE .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} \fICc\fR: List of Cc recipients.\& Not always Available.\& .RE .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} \fIBcc\fR: List of Cc recipients.\& Not always Available.\& .RE .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} \fIOriginalFrom\fR: List of senders of the original message.\& Available for quoted reply and forward.\& .RE .P Example: .P Get the name of the first sender.\& .nf .RS 4 {{(index \&.From 0)\&.Name}} .fi .RE .P Get the email address of the first sender.\& .nf .RS 4 {{(index \&.From 0)\&.Address}} .fi .RE .P .RE \fBDate and Time\fR .RS 4 The date and time information is always available and can be easily formatted.\& .P .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} \fIDate\fR: Date and time information when the compose window is opened.\& .RE .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} \fIOriginalDate\fR: Date and time when the original message of received.\& Available for quoted reply and forward.\& .RE .P To format the date fields, \fIdateFormat\fR and \fItoLocal\fR are provided.\& Refer to the \fBTEMPLATE FUNCTIONS\fR section for details.\& .P .RE \fBSubject\fR .RS 4 The subject of the email is available for quoted reply and forward.\& .P {{.\&Subject}} .P .RE \fBMIME Type\fR .RS 4 MIME Type is available for quoted reply and forward.\& .P .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} \fIOriginalMIMEType\fR: MIME type info of quoted mail part.\& Usually \fItext/plain\fR or \fItext/html\fR.\& .RE .P .RE \fBOriginal Message\fR .RS 4 When using quoted reply or forward, the original message is available in a field called \fIOriginalText\fR.\& .P .nf .RS 4 {{\&.OriginalText}} .fi .RE .P .RE .SH TEMPLATE FUNCTIONS .P Besides the standard functions described in go'\&s text/template documentation, aerc provides the following additional functions: .P \fBwrap\fR .RS 4 Wrap the original text to the specified number of characters per line.\& .P .nf .RS 4 {{wrap 72 \&.OriginalText}} .fi .RE .P .RE \fBquote\fR .RS 4 Prepends each line with \fI"> "\fR.\& .P .nf .RS 4 {{quote \&.OriginalText}} .fi .RE .P .RE \fBexec\fR .RS 4 Execute external command, provide the second argument to its stdin.\& .P .nf .RS 4 {{exec `/usr/local/share/aerc/filters/html` \&.OriginalText}} .fi .RE .P .RE \fBtoLocal\fR .RS 4 Convert the date to the local timezone as specified by the locale.\& .P .nf .RS 4 {{toLocal \&.Date}} .fi .RE .P .RE \fBdateFormat\fR .RS 4 Format date and time according to the format passed as the second argument.\& The format must be specified according to go'\&s time package format.\& .P .nf .RS 4 {{dateFormat \&.Date "Mon Jan 2 15:04:05 -0700 MST 2006"}} .fi .RE .P .RE \fBversion\fR .RS 4 Returns the version of aerc, which can be useful for things like X-Mailer.\& .P .nf .RS 4 X-Mailer: aerc {{version}} .fi .RE .P .RE \fBFunction chaining\fR .RS 4 All of the template functions can be chained together if needed.\& .P Example: Automatic HTML parsing for text/html mime type messages .nf .RS 4 {{if eq \&.OriginalMIMEType "text/html"}} {{exec `/usr/local/share/aerc/filters/html` \&.OriginalText | wrap 72 | quote}} {{else}} {{wrap 72 \&.OriginalText | quote}} {{end}} .fi .RE .P .RE .SH SEE ALSO .P \fBaerc\fR(1) \fBaerc-config\fR(5) .P .SH AUTHORS .P Originally created by Drew DeVault and maintained by Robin Jarry who is assisted by other open source contributors.\& For more information about aerc development, see https://sr.\&ht/~rjarry/aerc/.\&