jdavidbakr / mail-tracker

Package for Laravel to inject tracking code into outgoing emails.
MIT License
567 stars 129 forks source link

Mail tracker ip_address event listener #156

Closed Justproof closed 2 years ago

Justproof commented 2 years ago

Hi, Jon. I hope all is well. I'm unsure of how to use the event listener for ip_address added in November or if I understand the functionality.  Is this listener supposed to store the IP address of the email recipient in the database?

I created a listener for EmailViewed and registered the event to EventServiceProvider but I'm just not sure if this is supposed to grab the IP of the sender or recipient. If the ip_address trigger is for the recipient, is there documentation for storing this in a database table?

Everything else has been very easy for me to set up and is working great!

Take care, -Russell

jdavidbakr commented 2 years ago

It doesn't store it in the database, it simply retrieves it and passes it on to the event so you can store it or aggregate it or whatever you wish to do with it. The reason it's sent to the event is because the event is queued, and when the event is processed the IP address of the request is no longer available. See https://github.com/jdavidbakr/mail-tracker/issues/64#issuecomment-963095939