I want to enter email and company name in a form and then have to send a random generated password to that email given.
Below is my code for generating random password and sending the email.
<?php
$company_name = "";
$email = "";
if (isset($_POST['submit'])) {
$company_name = $_POST["company_name"];
$email = $_POST["email_address"];
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*_";
$password = substr(str_shuffle($chars), 0, 8);
$to = $email;
$subject = 'your registration is completed';
$message = 'Welcome' . $company_name . ''
. 'Your email and password is following :'
. 'Email:' . $email . ''
. 'Your new password : ' . $password . ''
. 'Now you can login with this email and password';
$headers = 'From :' . $email . "\r\n";
mail($to, $subject, $message, $headers);
}
?>
but this shows the below error.
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in "path"\password_generation.php on line 21
line 21 is mail($to, $subject, $message, $headers);