WP-Members は、WordPress の wp_mail() 関数を利用して電子メールを送信します。そのため wp_mail() についていくつかの事を理解しておくことが重要です:
- 既定では、全ての電子メールはプレーンテキストです。
- コンテンツタイプを変更することでHTML形式のメールを送信できます。
- デフォルトの「差出人」アドレスはWordPress のデフォルトである wordpress@yourdomain.com です。
- あらゆる電子メールの問題を解決するために自分でできる絶対的で最善の方法は、SMTP を使用して電子メールを送信することです。
原文を見る
WP-Members relies on WP’s wp_mail() function to send email. It’s important to understand a few things about wp_mail():
https://rocketgeek.com/plugins/wp-members/docs/customizing-emails/email-format/
- By default, all emails are plain text.
- You can send HTML formatted email by changing the content type.
- The default “from” address is WP’s default – wordpress@yourdomain.com.
- The absolute best thing you can do for yourself to solve all email problems is to use SMTP to send your email!
HTMLメールを送信する
HTML形式のメールを送信する場合は、コンテンツタイプを変更する必要があります。
このプラグインには電子メールを HTML 形式で自動的に送信するための設定が「メール」タブに用意されています。(注記: HTML 形式の電子メールを送信する場合、URL に関しては「自動的には」クリック可能になりません。リンクやその類いの形式のテキストには適切な HTMLマークアップを適用する必要があります。)
原文を見る
If you want to send HTML formatted email, you need to change the content type.
The plugin includes a setting in the Emails tab to automatically send emails as HTML format. (NOTE: When sending HTML formatted email, URLs are not “automatically” made clickable. You need to apply proper HTML markup for links and any other formatted text.)
https://rocketgeek.com/plugins/wp-members/docs/customizing-emails/email-format/
全ての WordPress メールを HTML 形式に変更する
wp_mail_content_typeフィルターを使用してコンテンツタイプを「text/html」に設定します。:
add_filter( 'wp_mail_content_type', 'my_set_mail_content_type' );
function my_set_mail_content_type( $content_type ) {
return 'text/html';
}
原文を見る
Use the wp_mail_content_type filter to set the content type to “text/html”:
https://rocketgeek.com/plugins/wp-members/docs/customizing-emails/email-format/add_filter( 'wp_mail_content_type', 'my_set_mail_content_type' ); function my_set_mail_content_type( $content_type ) { return 'text/html'; }
WP-Members が生成したメールのみを HTML 形式に変更する
wpmem_email_headersフィルターを使用すると、メールヘッダーをフィルタリングできます。 これを使用して電子メールのタイプを「text/html」に設定します。:
add_filter( 'wpmem_email_headers', 'my_wpmem_html_email' );
function my_wpmem_html_email() {
return "Content-Type: text/html" . "\r\n";
}
上記のフィルター関数のいずれかを functions.phpファイルまたはカスタムプラグインファイルに追加するとHTML形式の電子メールを送信できるようになります。これでプラグインの電子メール管理タブで電子メール本文にHTMLを使用できるようになりました (送信されるデータには適切なショートコードを必ず含めてください)。このサイトのコードスニペットの使用方法に関する詳細については、こちらをご覧ください。
原文を見る
The wpmem_email_headers filter allows you to filter the email headers. Use that to set the email type as “text/html”:
add_filter( 'wpmem_email_headers', 'my_wpmem_html_email' ); function my_wpmem_html_email() { return "Content-Type: text/html" . "\r\n"; }Adding one of above filter function to your functions.php file or a custom plugin file will allow you to send HTML formatted emails. Now you can use HTML in the email content in the plugin’s email management tab (be sure to include appropriate shortcodes for data being sent). There is more information on how to use code snippets from this site here.
https://rocketgeek.com/plugins/wp-members/docs/customizing-emails/email-format/