phpemailsendmail.exe

php mail using sendmail.exe


I am using XAMPP on a localhost windows VISTA m/c...using gmail as smpt server

I am trying to send an email using simple PHP script

here is the configuration details on sendmail.ini (I have the sendmail.exe and the other 2 dll in that directory)

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

default_domain=localhost

; 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=xxxxxxx
auth_password=xxxxxx

hostname=localhost

and I have changed the php.ini

[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

; For Win32 only.
;sendmail_from = xxxxx

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

and Once I call the script it goes into waiting...for localhost... here is the debug.log...

09/05/02 17:34:41 ** --- MESSAGE BEGIN --- 09/05/02 17:34:41 ** To: xxx@yahoo.com 09/05/02 17:34:41 ** Subject: Form Submission Results 09/05/02 17:34:41 ** From: My Web Site 09/05/02 17:34:41 ** Reply-To: xxx@gmail.com 09/05/02 17:34:41 ** 09/05/02 17:34:41 ** Name: xxx 09/05/02 17:34:41 ** E-Mail: xxx@yahoo.com 09/05/02 17:34:41 ** Message: hey test message 09/05/02 17:34:41 ** 09/05/02 17:34:41 ** 09/05/02 17:34:41 ** --- MESSAGE END --- 09/05/02 17:34:41 ** Connecting to smtp.gmail.com:465 09/05/02 17:34:41 ** Connected.

I am new to PHP and would like to know if there is a better way to do mail...I am not in for HTML/multipart mails with attachment now... Also i should be able to test in localhost without SMTP server installed . I would like to use GMAIL for now testing. THnks


Solution

  • I strongly suggest you use a library e.g. PHPMailer. Here is their gmail example.

    Another good library (which I haven't used) is SwiftMailer. Here is their gmail example.