15

次を使用してメールを送信しています: https://github.com/sendgrid/sendgrid-nodejs/tree/master/packages/mail

<a href="[Unsubscribe]">Unsubscribe</a>同等のものを追加する方法を見つけることができませんでした。これはここに文書化されています: https://sendgrid.com/docs/Classroom/Basics/Marketing_Campaigns/unsubscribe_groups.html#-Using-a-Custom-Unsubscribe-Link

Web サイトではショートコード [Unsubscribe] を使用するだけですが、sendgrid/mail パッケージ経由でメールを送信する場合、これは機能しません。

4

5 に答える 5

6
  1. https://app.sendgrid.com/ > 抑制 > グループの登録解除 > 新しいグループの作成

  2. group_id/ids を書き留めます。例: 123 (数値のみ!文字列ではありません) ここに画像の説明を入力

  3. node.js を使用してメールを送信する


const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(SENDGRID_API_KEY);


const tags = { invitedBy : Alex }
const msg = {
            to: email,
            from: { "email": SENDER_EMAIL, 
                    "name": SENDER_NAME 
                  },
            templateId: TEMPLATE_ID,
            dynamic_template_data: {
                Sender_Name: name,
                ...tags
            },
            asm: {
                group_id: 123,
                groups_to_display: [
                    123
                ],
            },
        };


await sgMail.send(msg); 

于 2020-10-04T21:09:36.747 に答える