<![CDATA[ eform additional data - My Forums]]> https://forums.modx.com/thread/?thread=46461 <![CDATA[Re: eform additional data]]> https://forums.modx.com/thread/46461/eform-additional-data#dis-post-268954 hOtTiGeR Dec 14, 2008, 03:35 PM https://forums.modx.com/thread/46461/eform-additional-data#dis-post-268954 <![CDATA[Re: eform additional data]]> https://forums.modx.com/thread/46461/eform-additional-data#dis-post-268953
<?php
function addUserInfo(&$fields){

/* Runs on eFormOnBeforeMailSent event 
 * Called before the message is sent. This function is called regardless of whether &noemail is set */

if(isset($_SERVER['REMOTE_HOST'])) $fromhost=$_SERVER['REMOTE_HOST'].' ('.$_SERVER['REMOTE_ADDR'].')';
else $fromhost=gethostbyaddr($_SERVER['REMOTE_ADDR']).' ('.$_SERVER['REMOTE_ADDR'].')';
$userInfo='<p>
From: '.$fromhost.'<br />
Using: '.$_SERVER['HTTP_USER_AGENT'].'
</p>';
$fields['userInfo']=$userInfo;

}

return '';
?>


I don’t include a timestamp because the email itself has one, but you could easily do that if you like.

Save this code as a snippet and call it on your form page before the eForm snippet call. In your eForm snippet call add &eFormOnBeforeMailSent=`addUserInfo`. And make sure that you have the [+userInfo+] placeholder at the end of your email template.

eForm event functions are the bomb!]]>
ZAP Dec 14, 2008, 03:30 PM https://forums.modx.com/thread/46461/eform-additional-data#dis-post-268953
<![CDATA[eform additional data]]> https://forums.modx.com/thread/46461/eform-additional-data#dis-post-268952
I was wondering how hard it would it to be include a time stamp, IP address and user agent in an email sent using eform?


Thanks]]>
hOtTiGeR Dec 14, 2008, 02:02 PM https://forums.modx.com/thread/46461/eform-additional-data#dis-post-268952