Page 1 of 1

mail() function

PostPosted: 22. February 2013 14:43
by Aronn00
Hello, i have to make a account verification php script for a school project and the ideea is that i can't get the mail. This is my php script:
Code: Select all
$mess="Your account have been registered. To activate click <a href='localhost/atestat3/activ.php?x=" . $rand . "'>here</a>.";
$mess=wordwrap($mess, 70, "\r\n");
mail($_POST['email'], 'Activation', $mess);

I read some posts that i need to configure something is php.ini, I tried some of the methods but it didn't work. I am using XAMPP v.1.8.1.
I want to use the mail with localhost if it's possible because i won't be able to install aditional programs.
Need help. Thanks!

Re: mail() function

PostPosted: 22. February 2013 15:14
by Nobbie
PHP cannot send mails on its own, even not with the mail function. This (very limited) mail function is only a relatively poor interface to an Email Server; you definitaly need a running SMTP Server (either on localhost or somewhere remotely) to send emails.

The mail function does not support Autorization on SMTP Servers.

Re: mail() function

PostPosted: 22. February 2013 15:57
by Aronn00
And how do i do that?

Re: mail() function

PostPosted: 22. February 2013 20:59
by JonB
You can use the 'sendmail' MTA (Mail Transfer Agent) included with XAMPP - There's a sendmail.ini file in the folder with examples, it can work standalone or with your ISP's SMTP server.

This question has also been answered dozens of times in this forum.

Good Luck
:)