First of all, it is important for you to know that it is impossible to find out if a user has opened a sent email because the SMTP protocol does not provide a way for us to identify this action. What we can do, is put some "triggers" inside the email to try to help us know when this occurred (I’ll cite some cases you specified in your doubt as well):
- Place a hidden image and when the client has the option to view html enabled, from this image that usually comes with a parameter together, you identify that that email has been opened. It may occur that the client is not with the html view enabled and still open your email and you would never be notified.
- Place a header in the email so that the sender is notified when e-mail is read. Feature famous in the late 90’s and early 00’s, however, customer 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 plugin, when you send the email through the
transporter.sendMail(data, function(callback) {
});
you have access to the callback.info object (enters other attributes) that provides the following variables:
- messageid: Most Transports should Return the final Message-Id value used with this Property (note that should = should therefore not be guaranteed either)
- envelope: includes the envelope Object for the message
- accepted: is an array returned by SMTP Transports (includes recipient Addresses that Were accepted by the server)
- Rejected: is an array returned by SMTP Transports (includes recipient Addresses that Were Rejected by the server)
- pending: is an array returned by Direct SMTP transport. Includes recipient Addresses that Were temporarily Rejected Together with the server Response
Because we are on a site that follows the Portuguese language, I imagine it would be prudent for you to translate the passages in English into Portuguese.
– Luiz Felipe
I accepted as an answer! Thank you.
– Mateus Veloso