จัดการสถานะการส่งด้วยส่วนขยายอีเมลของทริกเกอร์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เมื่อมีการเพิ่มเอกสารลงในคอลเล็กชัน ส่วนขยายจะเลือกเอกสารดังกล่าวเพื่อประมวลผลการนำส่งทางอีเมล
ส่วนขยายจะสร้างและอัปเดตdelivery
ฟิลด์ใน
เอกสารขณะประมวลผลอีเมล
การประมวลผลการส่งอีเมล
คุณสามารถป้อนข้อมูลในช่อง delivery
ได้โดยใช้ช่องต่อไปนี้
- state: หนึ่งใน
PENDING
, PROCESSING
, SUCCESS
หรือ ERROR
- startTime: การประทับเวลาเมื่อเริ่มการประมวลผลอีเมล
- endTime: การประทับเวลาเมื่อการประมวลผลอีเมลเสร็จสมบูรณ์ (กล่าวคือ สิ้นสุดในสถานะ
SUCCESS
หรือ ERROR
)
- ข้อผิดพลาด: หากเกิดข้อผิดพลาดในการนำส่งอีเมล ระบบจะแสดงข้อความแสดงข้อผิดพลาดที่นี่
- attempts: จำนวนครั้งที่พยายามนำส่งอีเมลนี้
- leaseExpireTime: ในกรณีที่เกิดการหยุดชะงักหรือหมดเวลา เวลาที่ควรพิจารณาสถานะ
PROCESSING
ว่าเป็นข้อผิดพลาด
- info: หลังจากส่งอีเมลสำเร็จ (ไปยังอีเมลอย่างน้อย 1 รายการ) ระบบจะป้อนข้อมูลในช่องนี้ด้วยช่องต่อไปนี้
- messageId: รหัสข้อความของอีเมลที่นำส่ง
- accepted: อาร์เรย์ของอีเมลที่นำส่งอีเมลสำเร็จ
- rejected: อาร์เรย์ของอีเมลที่ส่งอีเมลไปไม่ได้
- รอดำเนินการ: อาร์เรย์ของอีเมลที่ SMTP ปฏิเสธชั่วคราว
- การตอบกลับ: การตอบกลับล่าสุดจากเซิร์ฟเวอร์ SMTP
โดยปกติแล้ว อีเมลจะส่งจาก PENDING
ไปยัง PROCESSING
แล้วส่งต่อไปยัง SUCCESS
หรือ
ERROR
เมื่ออยู่ในสถานะ SUCCESS
หรือ ERROR
การเปลี่ยนแปลงเพิ่มเติมใน
เอกสารจะไม่ทริกเกอร์ให้ส่วนขยายส่งอีเมลอีก หากต้องการส่งอีเมลที่มีการอัปเดตเอกสารอีกครั้ง คุณสามารถเปลี่ยน state
เป็น PENDING
หรือ RETRY
ได้
การลองอีกครั้งด้วยตนเอง
มีบางกรณีที่การนำส่งอีเมลล้มเหลวในลักษณะที่กู้คืนได้ หรือ
แก้ไขเอกสารด้วยตนเองเพื่อนำส่งอย่างถูกต้องได้โดยมีการ
แก้ไขเล็กน้อย แม้ว่าการลองส่งใหม่จะไม่เป็นไปโดยอัตโนมัติ แต่คุณก็เปลี่ยนstate
ในช่องdelivery
เป็น RETRY
ได้ด้วยตนเอง เพื่อให้ส่วนขยายพยายามส่งอีเมลอีกครั้ง (และเพิ่มจำนวนattempts
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# Manage delivery status with the Trigger Email extension\n\n\u003cbr /\u003e\n\nWhen a document is added to the collection, the extension picks it up for email\ndelivery processing. The extension creates and updates a `delivery` field in the\ndocument as it processes the email.\n\nEmail delivery processing\n-------------------------\n\nThe `delivery` field can be populated with the following fields:\n\n- **state:** One of `PENDING`, `PROCESSING`, `SUCCESS`, or `ERROR`.\n- **startTime:** Timestamp when email processing began.\n- **endTime:** Timestamp when email processing completed (that is, ended in either a `SUCCESS` or `ERROR` state).\n- **error:** If there was an email delivery error, an error message will be populated here.\n- **attempts:** Number of delivery attempts for this email.\n- **leaseExpireTime:** In case of a hang or timeout, the time at which a `PROCESSING` state should be considered an error.\n- **info:** After successful email delivery (to at least one address), this field will be populated with the following fields:\n - **messageId:** The message ID of the delivered email.\n - **accepted:** Array of email addresses to which the email was successfully delivered.\n - **rejected:** Array of email addresses to which the email could not be delivered.\n - **pending:** Array of email addresses that were temporarily rejected by SMTP.\n - **response:** The last response from the SMTP server.\n\nAn email will typically go from `PENDING` to `PROCESSING` to either `SUCCESS` or\n`ERROR`. Once in the `SUCCESS` or `ERROR` state, additional changes to the\ndocument will not trigger the extension to send another email. To resend an\nemail with document updates, you can change the `state` to `PENDING` or `RETRY`.\n\nManual retries\n--------------\n\nThere are instances in which email delivery fails in a recoverable fashion or\nthe document can be manually corrected for proper delivery with minor\nmodifications. While retries are not automatic, you can manually change the\n`state` in the `delivery` field to `RETRY` so that the extension attempts email\ndelivery again (and increments the number of `attempts`)."]]