Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExpressionEngine - Notification email when 404 page visited?

According to the Template Manager hit count, my site is getting quite a few 404 hits. I can't seem to locate where those hits are coming in from, whether it's an one old dead link or several, etc.

I would like to have an email automatically sent to me from within my 404 template with segment data at the very least. What's the best way to do this in EE?

like image 633
Stephen Callender Avatar asked Dec 11 '22 21:12

Stephen Callender


2 Answers

The easiest way is to use an add-on that allow you to send an email from within a template. Here are two that work:

  1. "email_from_template" - http://rog.ee/email_from_template
  2. "Send Email" - http://devot-ee.com/add-ons/send-email
like image 143
Stephen Callender Avatar answered May 15 '23 09:05

Stephen Callender


Throwing another option in here...

Enable PHP on the 404 template and include a bit of PHP. Something like

mail ( toaddress , subject , message );

Butter that up any way you wish. You could pull out things like the url being requested and include them in the email.

<?php
  $url = 'http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
  mail('[email protected]','404 on website','Hit 404 page on site for URL:  '.$url);
?>
like image 32
foamcow Avatar answered May 15 '23 10:05

foamcow