0

I am learning php and mysql and I started a little home project to learn better and why not?

So I built a registration page that get all the informations fine, but it can't send the email to verify the account.

Here is the code to send emails:

//other code that is fine
$subject = "Signup | Verification";
$headers = "From: theemail@email.com \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$message = '<html><body>';
$message.='<div style="width:550px; background-color:#CC6600; padding:15px; font-weight:bold;">';
$message.='Email Verification mail';
$message.='</div>';
$message.='<div style="font-family: Arial;">Confiramtion mail have been sent to your email id<br/>';
$message.='click on the below link in your verification mail id to verify your account ';
$message.="<a href='http://192.168.1.106/register/user-confirmation.php?username=$username&email=$email&confirmation_code=$rand'>click</a>";
$message.='</div>';
$message.='</body></html>';

mail($email,$subject,$message,$headers);
//other code that is fine

I'm a working with a LAMP in a virtual machine collegated with bridge that's why in the verification link there is an ip adress.

pah
  • 4,700
  • 6
  • 28
  • 37
superuser
  • 57
  • 1
  • 7

1 Answers1

0

Most likely because you don't have a mail server set up in your local environment. The is some workarounds with this etc with postfix.

Here is something that might help you.

https://askubuntu.com/questions/47609/how-to-have-my-php-send-mail

Community
  • 1
  • 1
Aprilsnar
  • 521
  • 1
  • 5
  • 14