Log in

View Full Version : PHP Mail/Function Question



centenial
09-29-2006, 07:15 PM
Hi,

I have a PHP function called 'database_backup()' that makes a complete backup of a MySQL database. Every time I run the php file I want it to email me the backup. I tried doing it like this:



$my_message = database_backup();

mail($my_email, $my_subject, $my_message, $my_headers);


But that didn't work - How can I include the contents of a function in an email message?

Thanks,

djr33
09-29-2006, 09:53 PM
Well, that above is totally correct.
The problem must be in the database_backup() function.
Please post that.

Also, as a warning, note that some databases are huge. My forum, for example, though just text, is bordering on about 40mb right now. That's a lot more than you'd usually want to send via email.
If I were you, I'd output to text and have php create that .txt file to backup the database. But there are also automated tools that do this for you, so that might just be easier anyway.

If there is some particular reason to back it up to email, though, just post the function and we'll take a look.