Send mail on localhost via SMTP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Send mail on localhost via SMTP

Postby Schattenparker » 04. April 2019 10:22

I have the same problem. I cant send emails.
Here is my config:

php.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP=smtp.gmail.com
; http://php.net/smtp-port
;smtp_port=587

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = raspma1701@gmail.com
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"

; 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().
;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

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog
;mail.log = "C:\xampp\php\logs\php_mail.log"
;mail.log = "\xampp\apache\logs\php_mail.log"


sendmail.ini
mtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=myemail@gmail.com
auth_password=mypassword
force_sender=myemail@gmail.com


the script:
Code: Select all
$subject = "Unsere erste E-Mail";
$to = "email@email.xyz";
$body = "send this email";
if( mail($to, $subject, $body) ) {
echo "ok";
} else {
echo "not ok";
}


I dont even get an error message. yes, error_reporting is on.

Xampp 7.3.3 on Windows 10

Whats wrong with the configuration?
Schattenparker
 
Posts: 5
Joined: 04. April 2019 10:17
XAMPP version: 7.3.3
Operating System: Windows 10

Re: Send mail on localhost via SMTP

Postby JJ_Tagy » 04. April 2019 12:38

I’ve never used it, but in your php.ini, you have almost everything commented out. And in your send mail, i doubt the system will know what a mtp_server is.
JJ_Tagy
 
Posts: 757
Joined: 30. January 2012 13:44
Operating System: Windows 10 Pro x64

Re: Send mail on localhost via SMTP

Postby Schattenparker » 04. April 2019 13:32

I am sorry, i did a copy mistake.

this is the correct sendmail.ini
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=xxxxx@gmail.com
auth_password=xxxxx
force_sender=xxxxx@gmail.com


I tried different instructions, i dont really know whats correct in the php.ini
Schattenparker
 
Posts: 5
Joined: 04. April 2019 10:17
XAMPP version: 7.3.3
Operating System: Windows 10

Re: Send mail on localhost via SMTP

Postby wowberk » 05. May 2019 21:03

I have the same problem.
wowberk
 
Posts: 2
Joined: 05. May 2019 21:01
XAMPP version: 7.3.4
Operating System: win

Re: Send mail on localhost via SMTP

Postby wowberk » 05. May 2019 21:21

Ready !!
I had have the same problem.
My C:\xampp\sendmail\error.log return
19/05/05 22:15:43 : Username and Password not accepted. Learn more at<EOL> https://support.google.com/mail/?p=BadCredentials c11sm7207485wmb.12 - gsmtp<EOL>
And wikimedia say:
No fue posible enviar el correo de confirmación. Por favor, comprueba la validez de la dirección de correo.
El servidor indicó el error: Error desconocido en la función mail() de PHP.
I have changed the security in my account and now it works.
https://support.google.com/a/answer/6260879?authuser=1
wowberk
 
Posts: 2
Joined: 05. May 2019 21:01
XAMPP version: 7.3.4
Operating System: win


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 41 guests