2

I've just upgraded from XAMPP 1.7.3 to 1.8.0, this included quite a few changes (PHP 5.4 etc) as I went through the reinstallation of my dev-environment. Anyways, everything works now, except for Sendmail. Before, you had a configuration in sendmail.ini like this:

#defaults
logfile "C:\XAMPP\sendmail\sendmail.log"

## A freemail service example
account Hotmail
tls on
tls_certcheck off
host smtp.live.com
from [exampleuser]@testmail.loc
auth on
user [exampleuser]@hotmail.com
password [examplepassword]

# Set a default account
account default : Hotmail

Plus some values in php.ini:

sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
SMTP = localhost
smtp_port = 25

Now it all looks a lot different (and the old config wouldn't work), an example: http://pastebin.com/M83bNmJw

A little php mail script:

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
 $to = "someone@hotmail.com";
 $subject = "Hi!";
 $body = "Hi,\n\nHow are you?";
 if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
?>

Message delivery failed... I guess I'm too stupid to change the correct things, it just won't work, plus I barely get an error in my log-files, so I don't even know where to start.

AnFi
  • 10,493
  • 3
  • 23
  • 47
user828591
  • 1,212
  • 2
  • 17
  • 32

4 Answers4

1
 #GMAIL mit XAMPP 1.8.1 und sendmail
[CODE]
[sendmail]
; HOTMAIL
smtp_server=smtp.gmail.com
smtp_port=25
smtp_ssl=tls
tls_certcheck off
error_logfile=error.log
debug_logfile=debug.log
auth_username= xxxx.xxxx@gmail.com
auth_password=xxxxxxx


 this settings in php.ini   
 [mail function]
    ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
    ; SMTP = smtp.gmail.com
    ; smtp_port = 25

    ; For Win32 only.
    ; http://php.net/sendmail-from
    sendmail_from = xxxx.xxxx@gmail.com

    ; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesC:\xampp) fakemail and mailtodisk do not work correctly.
    ; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.  

    ; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
    sendmail_path = "\"C:\sendmail\sendmail.exe\" -t"

    ; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder
    ;sendmail_path = "C:\xampp\mailtodisk\mailtodisk.exe"

    ; Force the addition of the specified parameters to be passed as extra parameters
    ; to the sendmail binary. These parameters will always replace the value of
    ; the 5th parameter to mail(), even in safe mode.
    ;mail.force_extra_parameters =

    ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
    mail.add_x_header = Off

    ; Log all mail() calls including the full path of the script, line #, to address and headers
    mail.log = "C:\xampp\php\logs\php_mail.log"
neelesh
  • 19
  • 1
0

I see that in 1.8.0, the default will send mail through mailtodisk.exe. You have enabled it in your PHP config file, but have you disabled mailtodisk.exe?

In addition, you'll need to ensure that smtp_server in sendmail.ini is set to localhost.

I just found this solution myself, and all mail sent using PHP works.

Mike Rockétt
  • 8,947
  • 4
  • 45
  • 81
  • Michael, I've found a good example now (linked in a different post), in between the biggest issue was, that I used the sendmail-tag in the sendmail.ini twice (yeah, I'm too stupid to comment out everything). – user828591 Sep 10 '12 at 14:44
0

My xampp is 1.8.2 with window 8.1

In php.ini

    smtp_port = 587
    sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
    mail.add_x_header=Off

In sendmail.ini

    smtp_server=smtp.gmail.com
    smtp_port=587
    smtp_ssl=auto
    error_logfile=error.log
    auth_username=xxaayy@gmail.com
    auth_password=kskcmhlrjr

    pop3_server=
    pop3_username=
    pop3_password=

    force_sender=xxaayy@gmail.com
    force_recipient=
    hostname=

To account gmail "auth_password" you need create new password "Your application-specific passwords", check [here][1]

then follow these steps:

The problem is that sendmail has to be run as an administrator. This is the solution to help any one on my situation.

  1. Right click on sendmail.exe
  2. Properties
  3. Compatibility
  4. Change the configuration for all users
  5. Execute as Windows XP SP 3
  6. Execute as adminitrator
  7. test email

    $to = "aaaaaaa@domain.com";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";
    $headers = "From: xxaayy@gmail.com" . "\r\n";
    if (mail($to, $subject, $body, $headers)) {
       echo ("Message successfully sent!");
    } else {
       echo ("Message delivery failed...");
    }
    
-1

I've found a working example, it works like a charm now

http://blog.joergboesche.de/xampp-sendmail-php-mailversand-fuer-windows-konfigurieren#xampp_180_sendmail

user828591
  • 1,212
  • 2
  • 17
  • 32