messaging:attachment
添付ファイルを作成し、メールに追加します。
例
1<messaging:emailTemplate recipientType="Contact"
2 relatedToType="Account"
3 subject="Case report for Account: {!relatedTo.name}"
4 replyTo="support@acme.com">
5
6 <messaging:htmlEmailBody>
7 <html>
8 <body>
9 <p>Dear {!recipient.name},</p>
10 <p>Attached is a list of cases related to {!relatedTo.name}.</p>
11 <center>
12 <apex:outputLink value="http://www.salesforce.com">
13 For more detailed information login to Salesforce.com
14 </apex:outputLink>
15 </center>
16 </body>
17 </html>
18 </messaging:htmlEmailBody>
19
20 <messaging:attachment renderAs="PDF" filename="yourCases.pdf">
21 <html>
22 <body>
23 <p>You can display your {!relatedTo.name} cases as a PDF</p>
24 <table border="0" >
25 <tr>
26 <th>Case Number</th><th>Origin</th>
27 <th>Creator Email</th><th>Status</th>
28 </tr>
29 <apex:repeat var="cx" value="{!relatedTo.Cases}">
30 <tr>
31 <td><a href =
32 "https://na1.salesforce.com/{!cx.id}">{!cx.CaseNumber}
33 </a></td>
34 <td>{!cx.Origin}</td>
35 <td>{!cx.Contact.email}</td>
36 <td>{!cx.Status}</td>
37 </tr>
38 </apex:repeat>
39 </table>
40 </body>
41 </html>
42 </messaging:attachment>
43</messaging:emailTemplate>属性
| 属性名 | 属性型 | 説明 | 必須項目 | API バージョン | アクセス |
|---|---|---|---|---|---|
| filename | String | 添付ファイルのファイル名を設定する。指定されていない場合、ファイル名が自動的に生成されます。 | 14.0 | ||
| id | String | ページの他のコンポーネントが添付ファイルコンポーネントを参照できるようにする識別子。 | 14.0 | global | |
| inline | Boolean | メールの添付ファイルのコンテンツの配置をインラインに設定する。 | 17.0 | ||
| renderAs | String | 添付ファイルの表示方法を指定する。有効な値は、任意の MIME タイプまたはサブタイプです。デフォルト値は「text」です。 | 14.0 | ||
| rendered | Boolean | コンポーネントをページに表示するかどうかを指定する boolean 値。指定されていない場合、この値はデフォルトの true に設定されます。 | 14.0 | global |