Email opened/not tracking from nodejs nodemailer

后端 未结 4 2319
小蘑菇
小蘑菇 2021-02-20 06:37

What I know

I want to implement the email opened/not tracking in one of my websites. after searching i found that email-opened/not tracking is done by

4条回答
  •  悲&欢浪女
    2021-02-20 07:33

    EDIT: This answer is useless because the URL is resolved by nodemailer before sending the email. Still going to leave it here, as it may point someone to the right direction.


    As of nodemailer version 1.3.4, you can use URLs as attachments, eg:

    attachments: [
    {
      filename: 'receipt.png',
      path: 'http://example.com/email-receipt?id=1\&email=ex@ample.com',
      cid: 'receipt@example.com'
    }
    //...
    

    Then, you just embed it in your HTML:

    
    

    That will do the trick. Might be useful to mention that, in my case, the URL returns a file download.

    I still can't understand if the URL is resolved by nodemailer, while packing, or by the email client. But something is doing it because I've tested Thunderbird and Geary (desktop), Gmail and Rainloop (browser) and it's working.

    Can't guarantee that will work in every case, though.

提交回复
热议问题