Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-01-07 17:52:45

agovella
Member
From: Houston, TX
Registered: 2005-05-01
Posts: 66
Website Twitter

Email on error: What's wrong with my PHP code?

I’d like to the error page to send an email whenever it shows up.

I added:

<?php
$referrer = $_SERVER['HTTP_REFERRER'];
$url = $_SERVER['REQUEST_URI'];

$to = "ag@agux.co";
$subject = "Broken Link";
$message = $message = $referrer . "\r\n" . $url;
mail($to,$subject,$message,);
echo "Mail Sent.";
?>

It’s failing silently, so I’m not sure why Textpattern won’t send it. Any ideas?

{Edited to make the title match the topic. – Uli}

Last edited by uli (2013-01-11 22:38:38)

Offline

#2 2013-01-07 22:26:54

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: Email on error: What's wrong with my PHP code?

Probably no need to reinvent the wheel: There’s wan_error_email. Can’t tell whether it’s still working, but that’s tried quickly.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2013-01-08 13:50:01

etc
Developer
Registered: 2010-11-11
Posts: 5,192
Website GitHub

Re: Email on error: What's wrong with my PHP code?

mail($to,$subject,$message,); will produce a Parse error: syntax error, unexpected ')'.

Offline

Board footer

Powered by FluxBB