mail() function with PHP

Discussion in 'Scripts' started by Discovermypath, Jun 26, 2012.

to remove all ads.
  1. Discovermypath

    Discovermypath New Member

    Hello all,

    I have set up a local server (Apache) on my computer to test out PHP and MySQL. I installed Apache, PHP, MySQL and phpmyadmin all individually following a tutorial that was very helpful to follow.

    The problem is that I can't get the mail() to work and email me things from a contact form or whatever that I have set up. My code is all correct so their is no problems there.

    I have looked over a few forums on this subject but still haven't gotten anything to work. I have a gmail account that I want to have these practice emails sent to.

    Does anyone know of a fix for this. Right now I'm just going under the assumption that the mail() will work when I actually get a site on the web, but it would be nice to see everything work while I'm testing it out.

    Thanks for any advice in advance!!!
  2. DHDdirect

    DHDdirect New Member

    Turn on error reporting by putting this in your script:

    and see what comes up.
  3. Edge

    Edge Member

    In php.ini you need:

    SMTP = your.isp.mailserver.address

    sendmail_from =
  4. chrishirst

    chrishirst Well-Known Member Staff Member

    Just for anyone reading this in the future, and no-one has explained why as yet.

    It's because you don't have a mail server set up on your PC.

Share This Page