First of all, it's important for you to know that it's impossible to find out if a user opened an e-mail sent because the SMTP protocol does not provide a way for us to identify this action. What we can do is to put some "triggers" inside the email to try to help us know when this happened (I'll cite some cases that you specified in your question as well):
Place a hidden image and when the client has the option to view html enabled, from that image that usually comes with a parameter together, you identify that that email has been opened. It may occur that the client is not having the html view enabled and still open your email and you would never be notified.
Place a header in the e-mail so that the sender is notified when e-mail is read. Feature famous in the late 90's and early 00's, however, the client can cancel this notification manually.
Send a link in the email, forcing the client to enter the url to read the message (much like the idea of option 1)
To increase your email functionality, you can consult the documentation of the plugin when you send the e -mail through
transporter.sendMail(data, function(callback) {
});
You have access to the callback.info object (enter other attributes) which provides the following variables:
-
messageId : most transports should return the final Message-Id value used with this property (note that should = therefore not guaranteed)
-
envelope : includes the envelope object for the message
-
accepted : is an array returned by SMTP transports (includes recipient addresses that are accepted by the server)
-
rejected : is an array returned by SMTP transports (includes recipients that were rejected by the server)
-
pending : is an array returned by Direct SMTP transport. Includes recipient addresses that are temporarily rejected together with the server response