Sending email through php/sendmail (Win all) 1.7.7 [SOLVED]

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

Sending email through php/sendmail (Win all) 1.7.7 [SOLVED]

Postby ra_ie_darkness » 06. November 2011 12:48

Using xampp 1.7.7 on windows vista
I am trying to create a registration module where the user will receive an email upon registration.
I am trying to use google's smtp server for that purpose
these are the changes that i have made in php.ini
Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 465
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost

; 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"


Below is a part of send mail.ini
Code: Select all

smtp_server=smtp.gmail.com

; smtp port (normally 25)

smtp_port=465
; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify

smtp_ssl=auto
default_domain=google.com

; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging

;error_logfile=error.log

; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging

;debug_logfile=debug.log

; if your smtp server requires authentication, modify the following two lines

auth_username=mygmailid@gmail.com
auth_password=mygmailpassword


Finally this is the php file that i am trying to run
Code: Select all
<?php


$to='reciever@gmail.com';   
$subject='mysub';
$message='messagebody.';

$headers = 'From: mygmailid@gmail.com' . "\r\n" .
    'Reply-To: mygmailid@gmail.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to,$subject,$message,$headers);
echo 'see';

?>


when i use the port 586
the page only displays "see" but the recipients have not received any mail
but when i use port 465
the page keeps on loading forever and nothing happens.
I need to know what I'm doing wrong and how to fix it
ra_ie_darkness
 
Posts: 2
Joined: 05. November 2011 07:53
Operating System: Windows xp/vista/7

Re: Need to send email throught php using xampp 1.7.7

Postby Sharley » 06. November 2011 13:05

In the sendmail.ini file uncomment the log files and read them for possible clues.
default_domain should be commented out.
smtp_ssl=auto ??? - see new version of fake sendmail details below.
There are no ssl library files in the sendmail version in 1.7.7 - see new version info below.
;force_sender=me@localhost - you need to uncomment and add your gmail email address.
Not sure if the current old sendmail in 1.7.7 can handle gmail using TLS.

You can download and replace the current sendmail with the latest version from here:
http://glob.com.au/sendmail/
This includes the ssl libs and most likely will connect on any port you specify at gmail.


Your php.ini section should look like this as you are going to use sendmail exclusively
Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
; SMTP = smtp.gmail.com
; http://php.net/smtp-port
; smtp_port = 465
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost

; 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"


In XAMPP 1.7.3 MSMTP was used and was very successful in sending email to just about every known service including the use of TLS/SSL but sadly was discontinued.

In the next 2012 XAMPP version XAMPP Mail will replace fake sendmail but at this point in time details are thin on the ground.

I would be much obliged if you could provide some feedback if you use the latest fake sendmail version.
Thanks.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Need to send email throught php using xampp 1.7.7

Postby ra_ie_darkness » 06. November 2011 13:33

Thank you i downloaded the new send mail.
Copied sendmail.exe, sendmail.ini, ssleay32.dll and libeay32.dll to my sendmail folder in xampp.
It is working now
ra_ie_darkness
 
Posts: 2
Joined: 05. November 2011 07:53
Operating System: Windows xp/vista/7

Re: Need to send email throught php using xampp 1.7.7

Postby Sharley » 06. November 2011 13:38

Good news and thanks for the feedback. 8)

Best wishes. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 58 guests