XAMPP mail not working with PHP mail() function

19,536

You would have to configure the mercury server bundled with xampp to actually deliver/relay the mails.

But I suggest you use something like SwiftMailer instead of php's mail() function.

edit: there is a third option. The mini-smtp-client built into php/win32 can't do authentication. Therefore you can't simply put SMTP=mail.gmail.com; smtp_port=25 in your php.ini. But you can set sendmail_path and point to an application that can relay the message to another smtp server (including authentication), e.g. fake sendmail.
(But I still suggest swiftmailer)

Share:
19,536
Roger Travis
Author by

Roger Travis

Updated on June 14, 2022

Comments

  • Roger Travis
    Roger Travis almost 2 years

    I just installed XAMPP, Apache is running, so is MySQL and Mercury.

    In Dreamweaver I created a php file with a mail($to,$subject,$msg,'From:'.$email); function, but when I ran the file from localhost it showed an error. After playing around with xampp control panel, turning mercury on and off, it's not showing any errors, yet is not send the email either... any ideas?

    the 'admin' button on the cp for mercury does nothing.

    Thanks! R

  • Roger Travis
    Roger Travis about 14 years
    >>> You have to set your SMTP server settings in the php.ini file My not be that smart! :))) what should i set there?
  • Till
    Till about 14 years
    I think your mercury server is the smtp. Still, you need to configure mercury for this to work.
  • Pekka
    Pekka about 14 years
    @user you can configure PHP's mail() to use an external SMTP server (if you're on dialup/DSL, this is highly recommended anyway, mails from a local server are likely to get filtered as spam.)