Issues with Nodemailer in Node.js – Subject Showing in Message Body and Placeholder Issue

I’m facing an unexpected issue while using Nodemailer in Node.js via slack, The subject, which should be in the email subject line, is appearing in the message body. Below is a snippet of the relevant code

app.view('your_view_callback_id', async ({ ack, body, client }) => {
    console.log('View Submission Payload:', JSON.stringify(body, null));
    const subject = body.view.state.values.uik1r.sl_input.value;
    const message = body.view.state.values["35GrF"].ml_input.value;
    await sendEmail(client, subject, message)
    await ack();
    console.log('Acknowledged view submission', body);
});



async function sendEmail(subject, message){

    console.log('Subject:', subject);
    console.log('Message:', message);

   const transporter =  nodemailer.createTransport({
        host: 'smtp.gmail.com',
        port: 465,
        secure: true,
        auth: {
            user: process.env.EMAIL_USER,
            pass: process.env.EMAIL_PASSWORD,
        }
    })

    const info = await transporter.sendMail({
          from: "SlackEmail <[email protected]>",
          to: "[email protected]",
          subject:`This is just a test ${subject}`,
          text: message
    })
    console.log("message sent:" + info.messageId);
    console.log("Message info:", info);
    console.log("message rejected:" + info.rejected)
}

the subject will be logged under the message params
console.log(‘Message:’, message); as you can see in the logs

Message: Tech support
message sent:[email protected] “Tech support” was suppose to be under subject, the console.log(subject) doesn’t even show up in the logs.

I am also encountering an issue with the placeholder in the subject line. I tried adding some static content, The placeholder text is not displaying correctly, resulting in unexpected content such as “This is just a test [object Object].”, but this does show up in the subject line

here you can see the full payload

{
  "type": "view_submission",
  "team": {
    "id": "T7W2JV1EV",
    "domain": "fidelitypaymentserv"
  },
  "user": {
    "id": "UUE442C3E",
    "username": "mekstein",
    "name": "mekstein",
    "team_id": "T7W2JV1EV"
  },
  "api_app_id": "A0678L7J0A3",
  "token": "2IOpUFegFduPd4egrd7BU7Il",
  "trigger_id": "6269446301462.268086987505.739b418412dd1862ec8360bbe92ba936",
  "view": {
    "id": "V0683UZ2E1Z",
    "team_id": "T7W2JV1EV",
    "type": "modal",
    "blocks": [
      {
        "type": "input",
        "block_id": "uik1r",
        "label": {
          "type": "plain_text",
          "text": "Subject",
          "emoji": true
        },
        "optional": false,
        "dispatch_action": false,
        "element": {
          "type": "plain_text_input",
          "action_id": "sl_input",
          "placeholder": {
            "type": "plain_text",
            "text": "Placeholder text for single-line input",
            "emoji": true
          },
          "dispatch_action_config": {
            "trigger_actions_on": [
              "on_enter_pressed"
            ]
          }
        }
      },
      {
        "type": "input",
        "block_id": "35GrF",
        "label": {
          "type": "plain_text",
          "text": "Message",
          "emoji": true
        },
        "optional": false,
        "dispatch_action": false,
        "element": {
          "type": "plain_text_input",
          "action_id": "ml_input",
          "placeholder": {
            "type": "plain_text",
            "text": "Placeholder text for multi-line input",
            "emoji": true
          },
          "multiline": true,
          "dispatch_action_config": {
            "trigger_actions_on": [
              "on_enter_pressed"
            ]
          }
        }
      }
    ],
    "private_metadata": "",
    "callback_id": "your_view_callback_id",
    "state": {
      "values": {
        "uik1r": {
          "sl_input": {
            "type": "plain_text_input",
            "value": "Testing"
          }
        },
        "35GrF": {
          "ml_input": {
            "type": "plain_text_input",
            "value": "P200 is working as expected"
          }
        }
      }
    },
    "hash": "1701380188.P487UEAT",
    "title": {
      "type": "plain_text",
      "text": "Modal Title",
      "emoji": true
    },
    "clear_on_close": false,
    "notify_on_close": false,
    "close": null,
    "submit": {
      "type": "plain_text",
      "text": "Submit",
      "emoji": true
    },
    "previous_view_id": null,
    "root_view_id": "V0683UZ2E1Z",
    "app_id": "A0678L7J0A3",
    "external_id": "",
    "app_installed_team_id": "T7W2JV1EV",
    "bot_id": "B067LAB1GVB"
  },
  "response_urls": [],
  "is_enterprise_install": false,
  "enterprise": null
}

I have been working on this for hours already, I appreciate any assistace into resolving this issue.

As it seems you call the given method with three parameters:


await sendEmail(client, subject, message)

but it requires only two:


async function sendEmail(subject, message){

  • remove the unused parameter
  • add another parameter like _client to the method

6

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật