Use the Javascript `document.referrer.hostname'. Note that it will be null if the user navigated to your page via the address bar, and it doesn't work in IE, so enclose it in a trycatch block.
For different email campaigns, modify their links. So have one email campaign go to yoursite.com/landing.php?campaign=1 the other to yoursite.com/landing.php?campaign=2
To implement all this, create a php/jsp/asp file, landing.php that can record the email campaign. Make a similar bare-bones page, record.php, that records the sitename and IP. On every page of your site, add the javascript code. If the result isn't your sitename, blank, or null, have the JS AJAX-request the page record.php?fromsite=sitename&ip=IPAddress. Or something like that.