[WordPress] 外掛分享: HTML Emails

前言介紹

  • 這款 WordPress 外掛「HTML Emails」是 2010-04-05 上架。
  • 目前有 20 個安裝啟用數。
  • 上一次更新是 2010-05-05,距離現在已有 5477 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 2.9 以上版本才可以安裝。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

batmoo |

外掛標籤

html | email | html email | html emails | notification |

內容簡介

此外插件可以將預設的純文字電子郵件通知轉換為可完全自訂,好看的 HTML 郵件。

支援多站點 (WordPress 3.0) 將在不久的將來添加。

注意事項:

電子郵件會以可讀的純文字版本發送,以便於不支援 HTML 郵件的電子郵件客戶端。注意: 由於它們是自動生成的,因此它們有些粗糙。未來我可能會決定添加美觀的純文字版本,但這是低優先級的事情。
電子郵件僅經過 Gmail、Android 上的 Gmail 和 Outlook 測試,但應該可以在大多數電子郵件客戶端 (包括不支援 HTML 的客戶端) 上運作。如果您使用的是我未列出的客戶端,我會感激您通過電子郵件 提供關於電子郵件是否正常顯示和運作的信息。

如果有問題、建議或意見,請透過電子郵件與我聯繫。

自訂範本

您可以通過創建自己的範本,完全自訂任何電子郵件的外觀。電子郵件由兩部分組成:

電子郵件包裝 (所有電子郵件中通用的內容)
電子郵件訊息 (每個電子郵件獨特的內容)

自訂模板可以創建並放置在主題目錄或內容目錄 (/wp-content/ 在大多數站點上) 中。在 utils.php 中看到一些有用的函數,您可以在模板中使用。

電子郵件包裝

電子郵件包裝包含在所有電子郵件通知中通用的元素和標記。它包含您的 HTML、head 和 body 標籤以及任何其他在電子郵件中共享的元素。

要自訂電子郵件範本,請創建一個名為 html_email.php 的檔案,並將其添加到您的主題或內容目錄中。

注意: 模板中必須包含以下程式碼才能運作:

電子郵件包裝可以訪問以下變數:

$email_title: (string) 電子郵件的標題
$email_subtitle: (string) 電子郵件的副標題
$email_data: (array) 调用函数时传递的各种数据的关联数组

電子郵件訊息: 新留言

默認情況下,新留言和留言審核電子郵件共用相同的範本。您可以通過創建以下檔案,為每種評論類型創建分​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​訂的模板:

notify_postauthor_comment.php
notify_postauthor_trackback.php
notify_postauthor_pingback.php
notify_moderator_comment.php
notify_moderator_trackback.php
notify_moderator_pingback.php

如果您不想按評論類型自訂電子郵件,只需創建以下兩個範本:

notify_postauthor.php
notify_moderator.php

如果您只想共用兩種通知類型之間的自訂模板,只需創建以下內容:

notify_comment.php

新留言電子郵件訊息有以下數據變數可用:

$comment – (obj) 留言物件
$post – (obj) 文章物件
$comment_type – (string) 評論類型的 Slug
$comment_type_text – (string) 友好的評論類型名稱
$post_author – (obj) 文章作者資訊

原文外掛簡介

Converts the default plain-text email notifications into fully customizable, sweet-lookin’ HTML emails.
Multi-site support (for WordPress 3.0) will be added soon.
Notes:

Emails are sent with readable plain-text versions for email clients that don’t support HTML emails. Note: they’re somewhat crude because they’re auto-generated. I may decide to add decent-looking plain-text versions in the future, but that’s low priority.
Emails have only been tested on Gmail, Gmail on Android, and Outlook, but should work on most email clients (including clients without HTML support). If you’re using a client other than the 3 I’ve listed, I would appreciate an email with info on whether the email looks like it should and works correctly.

Send your questions, comments, suggestions via email.
Customizing Templates
You can fully customize the look of any of the emails by creating your own templates. Emails have two pieces:

Email Wrapper (content common across all emails)
Email Message (content unique to each email)

Custom templates can be created an placed in either your theme directory or your Content directory (/wp-content/ on most sites). See utils.php for a number of useful functions that you can use in your templates.
Email Wrapper
The Email Wrapper includes elements and markup that are common across all email notifications. It contains your html, head and body tags and any other elements that are shared across emails.
To customize the email template, create a file called html_email.php and add it to either your theme or content directory.
Note: you must include the following code in the template to work:

The Email Wrapper has access to the following variables:

$email_title: (string) title of the email
$email_subtitle: (string) subtitle of the email
$email_data: (array) Associative array of various data passed by the calling function

Email Message: New Comment
By default, new comment and comment moderation emails share the same template. You can create separate templates for both for each comment type by creating the following files:

notify_postauthor_comment.php
notify_postauthor_trackback.php
notify_postauthor_pingback.php
notify_moderator_comment.php
notify_moderator_trackback.php
notify_moderator_pingback.php

If you don’t want to customize the emails by comment type, just create the following two templates:

notify_postauthor.php
notify_moderator.php

If you just want a custom template shared between the two notification types, just create the following:

notify_comment.php

New Comment email messages have the following data variables available:

$comment – (obj) comment object
$post – (obj) post object
$comment_type – (string) slug for the comment_type
$comment_type_text – (string) friendly name for the comment_type
$comment_moderate – (bool) Whether the comment needs moderation or not

Using HTML Emails in your plugin
It’s pretty easy to use. The main call you need to make is htmlize_message() and pass the return into your wp_mail object. Details to come.
Credits

Blockquote image borrowed from the amazing Wu Wei theme by Jeff Ngan
Plain Text conversion script by Jon Abernathy aka Chuggnutt
Email styling inspired by WordPress.com Blog Subscription Notifications

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「HTML Emails」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


0.1 | 0.2 | 1.0 | 0.11 | trunk |

延伸相關外掛(你可能也想知道)

文章
Filter
Apply Filters
Mastodon