Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted February 16, 20223 yr 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.
March 11, 20223 yr Author 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.
March 11, 20223 yr Add the following to your "Contact form" email template {expression="\IPS\Request::i()->ipAddress()"}
March 13, 20223 yr Author @Nathan Explosion Yep; that did it. It's now working as intended. Thank you very much, absolute legend.