SendGrid - خطأ NoMethodError (لم يتم تعريف طريقة `[]` لصف nil:NilClass)

آها.. أجيب على سؤالي بنفسي، زر “اختبار التكامل” الخاص بـ Webhook يخدعك..

هذه هي الحمولة الفعلية إذا أرسلت بريدًا إلكترونيًا فعليًا إلى عنوان بريد إلكتروني غير موجود:

[
  {
    "bounce_classification": "Unclassified",
    "email": "noemail@this.does.not.exist.tld",
    "event": "bounce",
    "reason": "unable to get mx info: failed to get IPs from PTR record: lookup <nil>: unrecognized address",
    "sg_event_id": "Ym91bmNlLTQtNTA0ODUxOTUtZXVvMmlLeGRTYXlQRjRZRTQtLUk3QS0w",
    "sg_message_id": "euo2iKxdSayPF4YE4--I7A.recvd-5f54b5d587-pczjm-1-67BADEEA-6.0",
    "smtp-id": "<870b3a2a-160c-4fc8-bc9a-bd0d5b943b81@forum.umbraco.com>",
    "timestamp": 1740300320,
    "tls": 0,
    "type": "blocked"
  }
]

وهنا لدينا: لا يوجد حقل status.

هذا عندما أستخدم عن قصد نطاقًا غير موجود، أشعر أن هذا يجب معالجته، ربما يمكن أن يكون "type": "blocked" هو المؤشر الذي يبحث عنه Discourse.

كمحاولة مختلفة، وضعت شيئًا غير منطقي أمام outlook.com وهذا يعطيني حمولة عاملة:

[
  {
    "bounce_classification": "Invalid Address",
    "email": "oeihoiwehitwiohtriuweruiwerwierhwuerguiwerg@outlook.com",
    "event": "bounce",
    "ip": "149.72.1.78",
    "reason": "550 5.5.0 Requested action not taken: mailbox unavailable (S2017062302). [HK3PEPF0000021E.apcprd03.prod.outlook.com 2025-02-23T08:54:35.950Z 08DD502499E1A0AA]",
    "sg_event_id": "Ym91bmNlLTAtNTA0ODUxOTUtQWJFZ2pVejZUUFd3MnJNTnJabDg4Zy0w",
    "sg_message_id": "AbEgjUz6TPWw2rMNrZl88g.recvd-786d47b7ff-tsp86-1-67BAE249-D.0",
    "smtp-id": "<d8dc253e-6e9a-4418-8478-60780eb4898c@forum.umbraco.com>",
    "status": "5.5.0",
    "timestamp": 1740300876,
    "tls": 1,
    "type": "bounce"
  }
]