Is it possible to send an email during a die function along with the text output to the user. I have a script that I use for clients to download files to hide the directory structure to get to them. However out of human error or a weird email client that messes up the link users won't get directed to the file. In the script there is a check for that. If the file doesn't exist then it goes to die and spits out a message. Is it possible to send me an email notifying me?
Thanks!
Brian
seding mail during die along with text output
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: seding mail during die along with text output
Sure, post some code.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: seding mail during die along with text output
Code: Select all
if(!file_exists($file)) die("The file doesn't seem to exist.");- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: seding mail during die along with text output
Just put it in the if:bcyork wrote:Is it possible to put in the die () an aditional php script to send an email along with the message?Code: Select all
if(!file_exists($file)) die("The file doesn't seem to exist.");
Code: Select all
if(!file_exists($file)) {
mail('me@example.com', 'file not found', $file . ' was not found, blah, blah');
die("The file doesn't seem to exist.");
}mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.