Jump to content

Mail() help


bassguru

Recommended Posts

Hello everyone,

 

I want to send users an automatic email. I am using localhost (apache).

 

Below is the email php code:

 

//Send validation email to the user's email address
$to = $_POST['email'];
$subject = "Registration";
$body = "Hello,\n\nHere are some registration details.";
if (mail($to, $subject, $body)) {
        echo("<p>Email sent!</p>");
}

 

When I attempt to send an email, an error comes up:

 

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 C:\wamp\www\register.php on line 106

 

Therefore I believe the problem lies in the php.ini file. I have the php.ini set up with the following configurations:

 

[mail function]

; For Win32 only.

; http://php.net/smtp

SMTP = localhost

; http://php.net/smtp-port

smtp_port = 25

 

; For Win32 only.

; http://php.net/sendmail-from

sendmail_from = [email protected]

 

 

How do I configure my php.ini file to allow me to send emails? Do I need to setup my apache server (localhost) with some sort of email software? If so how?

 

Many thanks in advance

bassguru

Link to comment
https://forums.phpfreaks.com/topic/174069-mail-help/
Share on other sites

I don't use windows - but, as far as I am aware, mail is not automatically included in the windows server - only the *nix servers.

 

If no-one here can help specifically, the best source I've managed to dig out that seems to answer your query can be found here.

 

http://www.indigostar.com/smuman.htm

 

Hope it is of help.

 

Regards,

 

Phill.

Link to comment
https://forums.phpfreaks.com/topic/174069-mail-help/#findComment-917623
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.