1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Rep Power

    Apache and php mail; function

    I'm using the php mail function to send an email containing a submitted forms fields. I'm using the following code:

    PHP Code:
    $to "myemail@hotmail.com";
    $subject "Test mail";
    $message "Hello! This is a simple email message.";                     
    $from "someonelse@example.com";
    $headers "From:" $from;
    'Thank you. Your message was sent.'
    I'm not getting any of the emails, however the "Your message was sent" Text is showing, which is in a conditional that checks if the form was successfully submitted, so I know that's not it.

    I am testing and using this web application on my localhost using Apache server, I'm thinking maybe apache is the problem? Could it be, or do I have code wrong?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Rep Power
    it is not possible you to send this email from localhost.because The Email server is need it to set to localhost.
  4. #3
  5. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Washington, USA
    Rep Power
    I don't know what maximas is trying to say, but

    You need to check the return value from mail(). It could return false indicating that it couldn't send the mail - probably due to a configuration problem.
    If that's not it then try to use a more sophisticated mailing library, like PHPMailer. It can handle problems that you didn't even know you were facing.

IMN logo majestic logo threadwatch logo seochat tools logo