i want to send email from localhost to my email address(es). Email addresses may be at gmail, yahoo or frihost.
Can you tell me how to do it? I am using php for this, but an error occurs.
Also i am using XAMPP.
Please help me in doing so.
Thanks
http://nl2.php.net/manual/en/function.mail.php
that should always work. If it doesn't something is wrong with your installation.
This is the error message .
| Code: |
| Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\xampp\htdocs\php\functions.php on line 117 |
(This php\ directory is mine (not of the server).
Here are extracts from php.ini:
| Code: |
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "D:\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(), even in safe mode.
;mail.force_extra_parameters = |
Is something missing?
Here is the message:
| Code: |
$mail_body="<html>
<body>
<p>Congratulations! Your Account is Created at Example.<br></p>
<p>Please click <a href=\"http://www.example.com/verify.php?id=$verification\">here</a> to varify your Email Address or simply copy<br>
http://www.example.com/verify.php?id=$verification</p>
</body>
</html>";
mail($email,"Exmple.com Account Varification",$mail_body,"From: praisedpk@gmail.com"); |
| imagefree wrote: |
This is the error message .
| Code: | | Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\xampp\htdocs\php\functions.php on line 117 |
(This php\ directory is mine (not of the server).
Is something missing?
|
Yes.
An SMTP server. There isn't one running on localhost judging by the error message.
I think you should reinstall XAMPP
Install a mailserver - I think XAMPP includes one.
Note that some email providers may auto-block emails from a standard DSL/cable/dial-up line as mostly spam emails come from those.
Try to download one to be more sure of it.
XAMPP includes one. No need to install another one. Reinstalling XAMPP will most likely solve the problem.
Or you could set SMTP to your ISP mail server, or a public one like Yahoo.
for xampp, i know that there is a mail server include mercury Mail i think.. all you need is to run the application and try to set up a localhost host email in your outlook express.. that pointing to webmaster@localhost and you can now start sending via localhost for testing..
Maybe you just need to start mercury mail server from xampp page?