问题
I have problem i use xampp . i want check mail form but i can't see any result . i config Mercury/32 like this tutorial in this site :
http://system66.blogspot.com/2010/01/how-to-send-mail-from-localhost-with.html
i check email by outlook it's work . i check send mail by Mercury send mail in admin panel and it's correctly work .
but i can't send email and can not recive this email by outlook when i use mail php function .
why ?
please help me
回答1:
I got it . i set this config and now i can recieve my sent email in outlook:
I just need to configure
D:\xampp\sendmail\sendmail.ini
By default, it contains the line
smtp_server=mail.mydomain.com
I had to change it to
smtp_server=localhost
No need to configure this in the older versions of XAMPP.
The correct configuration for [mail function] in
D:\xampp\php\php.ini
is
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = 127.0.0.1 smtp_port = 25
; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesD:\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 = "\"D:\xampp\sendmail\sendmail.exe\" -t"
; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the D:\xampp\mailoutput folder
; sendmail_path ="D:\xampp\mailtodisk\mailtodisk.exe"
Now, I'm receiving mails in my inbox. Please note that "D:\xampp\" is my XAMPP installation path.
Thanks to all friends
回答2:
For this you need to call your ISP and ask them for the smtp out server address. Once done, You need to configure you SMTP settings in C:xampp\php\php.ini file or you can add the following line at the beginning of your php script.
ini_set("SMTP","yoursmtpoutgoingserver");
回答3:
You have to set your SMTP server settings in the php.ini file
[mail function]
; For Win32 only.
; "http://php.net/smtp"
SMTP = localhost
; "http://php.net/smtp-port"
smtp_port = 25
if you don't run a mailserver locally, you will need to access a remote one like your isp or gmail
[mail function]
; For Win32 only.
SMTP = mail.yourserver.com
smtp_port = 25
auth_username = smtp-username
auth_password = smtp-password
sendmail_from = you@yourserver.com
回答4:
This works for me, hope it will help you:
- Edit your php.ini (xampp\php\php.ini). Search for [mail function] and change these parameters accordingly.
- SMTP = smtp.gmail.com
- smtp_port = 587
- sendmail_from = [your_gmail_username]@gmail.com Note: this gmail account will be used to send the email
- sendmail_path = “\”D:\xampp\sendmail\sendmail.exe\” -t” Note: I did install my xampp at D:\xampp
- Edit your sendmail.ini (xampp\sendmail\sendmail.ini)
Comment the “Mercury” and “A free mail service example” contents as shown below:
# Mercury
#account Mercury
#host localhost
#from postmaster@localhost
#auth off
# A freemail service
#account Hotmail
#tls on
#tls_certcheck off
#host smtp.live.com
#from [exampleuser]@hotmail.com
#auth on
#user [exampleuser]@hotmail.com
#password [examplepassword]
- Add the account through which you want to send your mails. In my example I have configured the Gmail account as shown below:
- account Gmail
- tls on
- tls_certcheck off
- host smtp.gmail.com
- from [your_gmail_username]@gmail.com
- auth on
- user [your_gmail_username]@gmail.com
- password [your_gmail_password]
port 587
- Set the default account to Gmail as shown below:
account default : Gmail
来源:https://stackoverflow.com/questions/16890226/why-php-mail-function-not-work-in-xampp