Tripp★ Posted February 16, 2022 Share Posted February 16, 2022 Hi there, does anyone know how I can include an IP Address within sent messages via the contact form? I'm not talking about the form itself, but rather the email that is sent to the administrator when someone uses the contact form, I'd like the IP address to appear with that message. I initially looked at editing the email template to achieve this task but was unable to get it working. Can anyone help point me into the right direction? Not really interested in plugins or applications if I can help it. Thanks in advance. Link to comment Share on other sites More sharing options...
Daniel F Posted February 16, 2022 Share Posted February 16, 2022 1 hour ago, Tripp★ said: but was unable to get it working. How exactly did you try to add it? Link to comment Share on other sites More sharing options...
Tripp★ Posted March 11, 2022 Author Share Posted March 11, 2022 On 2/16/2022 at 5:18 AM, Daniel F said: How exactly did you try to add it? Sorry for the late reply, I got busy and forgot to check back. I can't really remember how I did it now, I think I looked in other areas where the IP address is sent in an email and tried to use that, or tried to modify it somehow so that it would take it from the session; I don't really recall. What would be the code/variable I need to add to the template? I can work on how to actually implement it to the template, but a pointer in the right direction would be nice. The reason why I am asking for this, or wanting to do this, is because we get a large volume of spam through it. Our favourite contactor is "Eric Jones" who thinks that my website is just swell, but wants to sell me something. This guy is pretty prolific and can seem to get around any CAPTCHA thing going on. So I was hoping to be able to start snapping the IP addresses so that I can start reporting them to Stop Forum Spam and the like. Link to comment Share on other sites More sharing options...
Nathan Explosion Posted March 11, 2022 Share Posted March 11, 2022 Add the following to your "Contact form" email template {expression="\IPS\Request::i()->ipAddress()"} DudeThatsErin and Tripp★ 2 Link to comment Share on other sites More sharing options...
Tripp★ Posted March 13, 2022 Author Share Posted March 13, 2022 @Nathan Explosion Yep; that did it. It's now working as intended. Thank you very much, absolute legend. Link to comment Share on other sites More sharing options...
Recommended Posts