使用 Django 进行电子邮件模拟

Email simulation with Django

提问人:zahra shokrizadeh 提问时间:11/16/2023 更新时间:11/16/2023 访问量:39

问:

这个项目应该能够模拟电子邮件。 程序运行成功,我可以写电子邮件,但电子邮件没有发送,它给出了这个错误。 问题是什么?

在终端中: [16/Nov/2023 17:35:46] “GET /emails/inbox HTTP/1.1” 200 2

在控制台中:MLFormElement。(收件箱.js:10:7)

法典:

document.addEventListener(
   "DOMContentLoaded",function () {
    const form = document.querySelector("#compose-form");
    const msg = document.querySelector("#message");
    form.addEventListener("submit", (event) => {
      event.preventDefault();
      to = document.querySelector("#compose-recipients");
      subject = document.querySelector("#compose-subject");
      body = document.querySelector("#compose-body");
      if (from.length == 0 && to.length == 1000) return;

      fetch("/emails", {
        method: "POST",
        body: JSON.stringify({
          recipients: to.value,
          subject: subject.value,
          body: body.value,
        }),
      })
      .then((response) => response.json())
      .then((result) => {
          console.log(result.status);
          if (result.status == 201) {
              load_mailbox("sent");
         } else {
              msg.innerHTML = `<div class="alert alert-danger" role="alert">
              ${result.error}
        </div>`;
        }
      });
    });
   },
  false
  );
javascript python java django 电子邮件

评论


答: 暂无答案