简体   繁体   English

来自 email 的响应

[英]Response from email

I am using cloudmailin and receiving all the reply mails(If someone replies to the emails i send them), now when i do request.raw(), i get all my replies in string format like this:我正在使用 cloudmailin 并接收所有回复邮件(如果有人回复我发送给他们的电子邮件),现在当我执行 request.raw() 时,我会以字符串格式收到所有回复,如下所示:

{
  "headers": {
    "received": "xxx.google.com with SMTP id c1so1731393vsh.8        for <xxxx@cloudmailin.net>; Sun, 06 Jun 2021 20:19:02 -0700",
    "date": "Mon, 07 Jun 2021 08:48:53 +0530",
    "from": "ABC <xxx@gmail.com>",
    "to": "xxx@cloudmailin.net",
    "message_id": "<xxx@mail.gmail.com>",
    "in_reply_to": "<xxx@gmail.com>",
    "references": "<xxx@gmail.com>",
    "subject": "Re: Update On Your Ticket #66",
    "mime_version": "1.0",
    "content_type": "multipart/alternative; boundary=000000000000c465af05c4248031",
    "dkim_signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=20161025;        h=mime-version:references:in-reply-to:from:date:message-id:subject:to;        bh=bD3ONqLV7AId5UzdUHe8gDLobCQrtQFYsq2u/8iYIhk=;        b=CEHWz5AC3REury8SN4wyg8wxum9H0CmXqT3XJTOjdP0pa5YpCXHPUDMjjLgYf0upd6         rM7qOI7GGHmzNGATmjxu/iQhRD5VaVxOi/VBrExMwlbFzXz8Dg6PoILI2dDnn5oZuzWi         zwujwLEVm7VcY2hetWrJYlBfzL5FtSa5W7gZDH42EyqYTDyzLPhWYBPueCSjqfgbXfWH         Wb2roecATRV+W9GQZNF7oOKbvpW5ASjzys7a5Llo2xkVfqlvsJli5aIFlUoY1nozj/v7         D/0zkojKlmyDUGEqRxrcIU8JFPm8gl0Ctnx1GgjiZ2vkvWv9oUNpMZdQU3khTbO8WzSV         ss7Q==",
    "x_google_dkim_signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20161025;        h=x-gm-message-state:mime-version:references:in-reply-to:from:date         :message-id:subject:to; 
       bh=bD3ONqLV7AId5UzdUHe8gDLobCQrtQFYsq2u/8iYIhk=;        b=Zs0h+EM3gcygNli6sm5CpodTr1kziEkj+W5ceiKiaGo2XZVMOXq85IZBY5jaOUspmF         R15pIV36BDP1mI2y0GbRE+jcIq7I6MjIxpDusRrxMDnADYyS5jRNk2YfqJC+4ml2MLSz         LGX+4JugPBp4QJq1dDPAGrqP8hfrXNLXcDZx7rUck9LCgbP59nUvDNndYUcbF45xa+oV         RvCvYo7ue69ogrc+/DM1b2uzP+lU7oY68yFhpfEGctWGaj36vsOcgrSA+FM7bB0UChWI         HVhRwFIzq+tdKH+lJvqMbnxeCSqSL8p0TofGHEKfN4D+POaYVLW59wegz5i7K2Vdpq/l         Spog==",
    "x_gm_message_state": "AOAM533Hi5baxQtGjkRr4KU1AyKeRfihKQKBKyyQu6Si4uto+Fy8F1jB\tZamxinSc8qQ6vbsNhXqvOvuhBP5iFo23kcz2DEfqY28=",
    "x_google_smtp_source": "ABdhPJzSzz9bec+GYLzqjqOWnZ4BOEmm8Yt56FcCc0cr2D6Pag5pWL+Qq2Q7SBXzw+7gBxq1onhFX1KhlhE6yjxuyu4=",
    "x_received": "by 2002:a05:6102:dca:: with SMTP id e10mr2789248vst.47.1623035941773; Sun, 06 Jun 2021 20:19:01 -0700 (PDT)"
  },
  "envelope": {
    "to": "xxx@cloudmailin.net",
    "recipients": [
      "xxx@cloudmailin.net"
    ],
    "from": "xxx@gmail.com",
    "helo_domain": "xxx.google.com",
    "remote_ip": "abc.de.fg.ql",
    "tls": true,
    "tls_cipher": "TLSv1.3",
    "md5": "xxx",
    "spf": {
      "result": "neutral",
      "domain": "gmail.com"
    }
  },
  "plain": "Yes, what about you?\n\nOn Mon, Jun 7, 2021 at 8:48 AM <xxx@gmail.com> wrote:\n\n> xxx@gmail.com replied to your ticket\n>\n> Message: all cool?\n>\n",
  "html": "<div dir=\"ltr\">Yes, what about you?</div><br><div class=\"gmail_quote\"><div dir=\"ltr\" class=\"gmail_attr\">On Mon, Jun 7, 2021 at 8:48 AM &lt;<a href=\"mailto:xxx@gmail.com\">xxx@gmail.com</a>&gt; wrote:<br></div><blockquote class=\"gmail_quote\" style=\"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex\"><a href=\"mailto:xxx@gmail.com\" 
target=\"_blank\">xxx@gmail.com</a> replied to your ticket <br><p>Message: all cool?</p>\r\n</blockquote></div>\r\n",
  "reply_plain": "Yes, what about you?",
  "attachments": [

  ]
}

how to get only the html part from this message?如何从此消息中仅获取html部分? I cannot loop through the object as it is a string, from this entire data i want only the html part of the message.我无法遍历 object 因为它是一个字符串,从这整个数据中我只想要消息的 html 部分。 can you help me with this?你能帮我解决这个问题吗?

Use JSON.parse() to parse the response string to a JSON object.使用 JSON.parse() 将响应字符串解析为 JSON object。 From there, you can use standard property access to get the values you need.从那里,您可以使用标准属性访问来获取您需要的值。

Example:例子:

 const data = JSON.parse(....); const html = data.html; const subject = data.headers.subject;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从codeigniter控制器发送电子邮件后,无法在jquery中获得响应 - Unable to get the response in jquery after sending email from codeigniter controller 电子邮件地址是来自流星JS中的Campaign Monitor API的无效响应 - Email address is invalid response from campaign monitor api in meteor js 通过XMLHttpRequest发送电子邮件没有响应 - sending email via XMLHttpRequest no response [Google script]如何从表单提交中分配生成的编辑响应URL,然后将其分配给确认email中的按钮? - [Google script]How to assign generated edit response URL from a form submission and then assign it to a button in confirmation email? 如何在我的过滤器中包含来自 API 的更多响应字段,例如:email - How include more response fields from API in my filter, ex: email 我想通过 Javascript/Google App Script 中的 API 响应向用户发送电子邮件? - I want to send email to user from API response in Javascript/ Google App Script? 如何在从 NodeJs 发送的 React js 中捕获响应以检查电子邮件是否已存在于数据库中 - How to catch response in React js sent from NodeJs to check if email already exists in the database 我该如何回复来自提交人的电子邮件(Google App脚本) - How do I make a response email be from the person submitting (Google App Script) Wordpress使用Jquery发送带有回调和响应的电子邮件 - Wordpress send email with callback and response using Jquery 响应CRM 2011中的电子邮件活动图像 - Response Email Activity Images in CRM 2011
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM