[Bug] WooCommerce attachment emails fail on Azure App Service — ABSPATH resolves incorrectly in containerized WordPress (v1.2.1)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
調査の方向性
admin/mailer/class-azure_app_service_email-controller.php から開始して generate_request_body() を調査し、次に、記載されている WordPress および WooCommerce の構成を使用して Azure App Service コンテナー内で添付ファイル付きメールの失敗を再現します。注文通知メールに請求書 PDF の添付ファイルが付いた状態で正常に配信され、添付ファイルのないメールも引き続き機能すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
On Azure App Service containerized WordPress deployments, WooCommerce order
notification emails that include attached invoice PDFs fail silently with the
following error in the Azure Email Logs:
Request body validation error. ContentBytes invalid. Should be base64
Basic emails (contact forms, password resets) send successfully. Only emails
with attachments are affected.
Root Cause
In admin/mailer/class-azure_app_service_email-controller.php, the
generate_request_body() method resolves attachment paths using ABSPATH:
foreach ($filePaths as $path) {
if ($path[0] !== '/') {
$path = ABSPATH . trim($path);
}
if (file_exists($path)) { ... }
}
On Azure App Service containerized WordPress, ABSPATH resolves to
/var/www/html while the actual running WordPress root is
/var/www/wordpress. The path resolves incorrectly, file_exists() returns
false, the attachment is silently dropped, and the ACS REST API rejects the
malformed request body.
The "ContentBytes invalid" error is a red herring — the real issue is a path
mismatch between ABSPATH and the actual WordPress root inside the container.
Steps to Reproduce
- Deploy WordPress on Azure App Service (Linux, containerized)
- Install WooCommerce and the App Service Email plugin v1.2.1
- Place a test order
- Observe that the New Order and Processing Order emails never arrive
- Check Azure Email Logs — error reads "ContentBytes invalid. Should be base64"
Expected Behavior
WooCommerce order notification emails send successfully with attached invoice
PDFs via Azure Communication Services.
Actual Behavior
Emails with attachments fail. Emails without attachments succeed.
Proposed Fix
Replace ABSPATH with a path derived from WP_CONTENT_DIR, which correctly
resolves to the active WordPress root regardless of container layout. Also
adds an empty path guard and immediate trim to prevent related edge case
failures:
foreach ($filePaths as $path) {
$path = trim($path);
if (empty($path)) { continue; }
if ($path[0] !== '/') {
$wp_root = rtrim(str_replace('wp-content', '', WP_CONTENT_DIR), '/');
$path = $wp_root . '/' . $path;
}
if (file_exists($path)) { ... }
}
A community fix including a PowerShell automation script and full root cause
analysis is documented here:
https://github.com/JONeillSr/Repair-AppServiceEmailAttachmentPatch
Environment
| Component | Version |
|---|---|
| App Service Email Plugin | v1.2.1 |
| WordPress | 7.x |
| WooCommerce | 8.x+ |
| Azure App Service | Linux, containerized |
| PHP | 8.x |
Workaround
Apply the patch manually via SSH or using the PowerShell automation script
linked above. The fix is confirmed working in production.
- 主要言語
- HCL
- スター
- 139
- フォーク
- 84
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/wordpress-linux-appservice のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
Azure/wordpress-linux-appservice#220 · コメント 1 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
Azure/wordpress-linux-appservice#223 · コメント 3 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Azure/wordpress-linux-appservice の issue をすべて見る
似ている issue
-
priority: low 🌱 type: enhancement 💅🏼
難易度 2/5 半日 初心者へのやさしさ 84/100
nebari-dev/llm-serving-pack#199 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
linebender/parley#849 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
rohitg00/agentmemory#1428 ·
メンテナーはふだん 1 日以内に返信