Results 1 to 2 of 2

Thread: PHP Mail/Function Question

  1. #1
    Join Date
    May 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Mail/Function Question

    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:

    Code:
    $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,

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •