#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    $notifyemail help


    Hey everyone. New member with what I hope is a simple question.

    I'm trying to set up a notifier for when a script runs via a cron job that it sends me an email. My website currently uses cPanel which I know has its own built in notifier, but I'm trying to create a customized response.

    Anyway, the partial script I'm using is:
    PHP Code:
    <?php

    // Notification information
    $notifyemail "email@domain.com"// Email address to send results

    // Send email
    {
        
    mail($notifyemail'Backup of Whatever.com is complete''Your weekly backup of Whatever.com has been completed and is ready to be downloaded.'); 
    }


    ?>
    The script this is embedded in runs fine, and it sends the email perfectly, but the From address is the address of the server, which uses the cPanel accounts username. To be this is not very smart.

    Is there a way I can customize the above script to change the From address to something else?

    Thanks!
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,866
    Rep Power
    6351
    The $additional_headers listed in the manual page can be used to set an alternative FROM address. Examples in the comments.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0
    Thanks for the link. It was very helpful.

IMN logo majestic logo threadwatch logo seochat tools logo