13
Contributors
13
Replies
128
Views
6 Years
Discussion Span
Last Post by Muhsin Mohamed
Featured Replies
  • 1
    diafol 3,720   6 Years Ago

    [QUOTE=;][/QUOTE] You need to set up your local machine to do that (SMTP). Mercury Mail will allow you to do this. It should be included in the full xampp download for windows. Read More

1

You need to set up your local machine to do that (SMTP). Mercury Mail will allow you to do this. It should be included in the full xampp download for windows.

0

hi. here is my tested solution.

you only have to modify 2 ini files: php.ini and sendmail.ini

1)look for mail function in php.ini(c:/xampp/php/php.ini)>>[mail function]

change the following::

SMTP=smtp.gmail.com

smtp_port=587


sendmail_from = from@gmail.com

sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

NOTE: ensure that the path you specify for sendmail_oath is valid.In my case it is in C.
SAVE your changes.


2) next modify sendmail.ini(c:/xampp/sendmail/sendmail.ini)
comment the mercury as shown below

# Mercury
#account Mercury
#host localhost
#from postmaster@localhost
#auth off

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

then paste the following lines:

account Gmail
tls on
tls_certcheck off
host smtp.gmail.com
from x@gmail.com
auth on
user x@gmail.com
password x

port 587

# Set a default account
account default : Gmail

Again SAVE your changes.

Use the code below to test if it's working!
<?php
$subject="Test mail";
$to="someone@whatever.com";
$body="This is a test mail";
if (mail($to,$subject,$body))
echo "Mail sent successfully!";
else
echo"Mail not sent!";
?>

NOTE in the above configuration the sender should use gmail email service,for the recipient any email service will do.

Edited by novice02: n/a

0

Hi there mr. novice02!

i followed and tested your post just now, im just confused about the section #2 you specified there, it looks so different in my sendmail.ini file, here are the contents of my sendmail.ini file:

; configuration for fake sendmail

; if this file doesn't exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail

[sendmail]

; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.

;smtp_server=localhost

; smtp port (normally 25)

;smtp_port=587

; 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=local

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

; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines

;pop3_server=
;pop3_username=
;pop3_password=

; to force the sender to always be the following email address, uncomment and
; populate with a valid email address. this will only affect the "MAIL FROM"
; command, it won't modify the "From: " header of the message content

;force_sender=me@localhost

; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if required

;hostname=localhost

so far im user xampp v1.7.7, ive been struggling with this problem for the past 4hours and have been unlucky to find any solutions so I decided to search out the net...

-1

I have tried setting up the mail server xampp then tested but getting no error and no email being sent either !!! please help. I can post php.ini and sendmail.ini if required.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.