> ## Documentation Index
> Fetch the complete documentation index at: https://foliant-help.iforiti.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 撰寫電子郵件的主旨與訊息

> 使用 Liquid 變數與 Markdown 撰寫 Foliant 寄出之電子郵件的主旨與訊息，並以您最新的訂單預覽。

# 撰寫電子郵件的主旨與訊息

![含有主旨、訊息與 Liquid 變數的電子郵件卡片](https://mintcdn.com/foliant-dev/nnNby4-r9e5xN6eK/pdf-delivery/images/write-the-email.png?fit=max\&auto=format\&n=nnNby4-r9e5xN6eK\&q=85\&s=c2b268765ce0fdce4e1f77da0d2f8f2b)

Foliant 寄出的每封電子郵件都有各自的主旨與訊息。您可以使用 Liquid（與您的文件相同的範本語言）填入訂單詳細資料，並以 Markdown 設定訊息格式。儲存前，預覽會以您最新的訂單顯示電子郵件的樣子。

## 編輯電子郵件

1. 前往 **傳送**，開啟該電子郵件（顯示「Emailed by Foliant」的那一列）。
2. 在 **電子郵件** 區段中，確認已選取 **編輯**。
3. 修改 **主旨**（最多 255 個字元）與 **訊息**（最多 5,000 個字元）。
4. 使用儲存列儲存。

新的電子郵件預設使用以下主旨與訊息：

```liquid theme={null}
{{ document.title }} {{ document.number }} for order {{ order.name }}
```

```liquid theme={null}
Hello {{ customer.first_name | default: "there" }},

Your {{ document.title }} for order {{ order.name }} is attached.

{{ shop.name }}
```

## 您可以使用的變數

在 **您可以使用 Liquid：** 下方，選取變數即可複製，再貼到主旨或訊息中。

| 變數 | 顯示內容 |
| - | - |
| `{{ order.name }}` | 訂單名稱，例如 #1001。 |
| `{{ order.total_price \| money }}` | 訂單總額，以金額格式顯示。 |
| `{{ customer.first_name }}` | 顧客的名字。 |
| `{{ shop.name }}` | 您的商店名稱。 |
| `{{ document.title }}` | 範本名稱，例如發票。 |
| `{{ document.number }}` | 文件編號（適用於已開啟編號的發票、折讓單與報價單）。 |

電子郵件可使用與您的範本相同的訂單資料與篩選器（`money`、`date` 等）。請參閱 [Liquid 篩選器](https://foliant-help.iforiti.com/zh-Hant/template-editor/liquid-filters.md)。

## 設定訊息格式

訊息中可使用 Markdown：`**bold**`、`*italic*` 與連結。空白行會開始新段落。您輸入的 HTML 會以文字顯示，而不會當作標記。

## 您商店的其他語言

如果您的商店以多種語言銷售，**主旨** 與 **訊息** 的標籤旁各有 **新增語言**（加入翻譯後會改為顯示 **Languages** 及數量）。選取即可開啟 **Manage translations**，選取 **新增語言** 並選擇您的商店在 Shopify 中發佈的語言，再以各語言撰寫主旨或訊息。選取 **完成**，然後儲存。

顧客收到電子郵件時，Foliant 會以其訂單的語言撰寫。若顧客不在收件者中，您的商店與其他地址會收到以商店主要語言撰寫的郵件。您留白的語言會顯示主要語言。預覽會顯示主要語言。

## 預覽電子郵件

選取 **預覽**。Foliant 會以郵件用戶端的樣式顯示電子郵件，包括 **從**、**到**、**回覆地址**、**主旨**、訊息及附加 PDF 的檔案名稱，並依您輸入的內容以最新的訂單呈現，即使尚未儲存也可以。

預覽下方的說明會指出使用了哪一筆訂單。文件編號會在電子郵件寄出時填入。

如果 Liquid 有錯誤，預覽會顯示錯誤，儲存時也會說明問題所在（「The subject's Liquid has an error: …」；若為其他語言，會標出語言代碼，例如「The message's Liquid (fr) has an error: …」）。

## 注意事項

* 主旨會以單行寄出：換行與 HTML 會被移除。
* 訊息必須能解析為 Liquid 才能儲存。訊息可以留空，但主旨為必填。
* 若商店語言為由右至左書寫（阿拉伯文、希伯來文、波斯文、烏爾都文），訊息會靠右對齊。
* 每封電子郵件的寄件者都會顯示您的商店名稱，回覆會寄到您商店的電子郵件。若要從您自己的地址寄送，請參閱 [從您自己的網域寄送](https://foliant-help.iforiti.com/zh-Hant/pdf-delivery/sending-domain.md)。
* PDF 會以附件形式附上。超過 10 MB 時，電子郵件會改為提供連結。

## 相關文章

* [使用 Foliant 以電子郵件寄送 PDF](https://foliant-help.iforiti.com/zh-Hant/pdf-delivery/emails-sent-by-foliant.md)
* [寄送測試電子郵件](https://foliant-help.iforiti.com/zh-Hant/pdf-delivery/send-a-test-email.md)
* [從您自己的網域寄送](https://foliant-help.iforiti.com/zh-Hant/pdf-delivery/sending-domain.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.