One of my Magento CE 1.7 sites contact form is being spammed by human spam farms thus bypassing the Google reCaptcha implemented on such forms. The rate of spam received is an exorbitant 300 emails a day that have successfully verified the captcha.
As the contact form is being used, no sender ip address is being emanated with the email, hence I need help and guidance on how to obtain the user IP and have this included with the spam contact email that I receive.
The idea is to ban the IPs that are being used for spamming.
The php call to get the user IP
echo Mage::helper('core/http')->getRemoteAddr(true);
How can I use this within the contact form and have the IP submitted with the contact form contact.
I appreciate all the help.
With best regards
Fab
Andrew,
Thanks a lot.
The correct IP showed up with this adjustment over your code:
public function postAction()
{
$post = $this->getRequest()->getPost();
if ( $post ) {
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
try {
$postObject = new Varien_Object();
$postObject->setData($post);
// Add the IP..
$postObject->setData(
'ip',
$_SERVER['REMOTE_ADDR']
);
Thanks a lot once again