I previously created a PHP mailer before, but for some reason, I cannot get this one to work.
I started using mysqli, but I don't think that really matters in this case.
So, I have a modal which contains a FORM called #addNewUserForm. Inside this FORM, I have various INPUTs that take in the following values:
<form role="form" action="api/addUser.php" method="get" id="addNewUserForm" name="addNewUserForm">
<input type="text" class="form-control username" id="username" name="username" />
<input type="text" class="form-control fullname" id="fullname" name="fullname" />
<input type="text" class="form-control" id="email" name="email" />
There are a few more INPUTs, but these three is what is necessary for sending the email.
So, once the user clicks this FORM BUTTON:
<button type="submit" class="btn" id="addNewUserSubmit" name="addNewUserSubmit">Submit</button>
</form>
I send the values over to a PHP file called addUser.php.
In addUser.php, begins like this:
<?php
if(isset($_GET['addNewUserSubmit']))
{
$username = mysqli_real_escape_string($_GET['username']);
$full = mysqli_real_escape_string($_GET['fullname']);
$email = mysqli_real_escape_string($_GET['email']);
// I have some database processing here
// now the mail feature
$to = $_GET['email']; // I also tried just using the $email variable
$subject = 'Business Registration';
$headers = "From: do not reply @ Business" . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "You have received a message from Business Applcation:<br /><br />";
$message .= "Greetings <strong>" . $_GET['fullname'] . "</strong>,<br /><br />"; // also tried $full variable
$message .= '<html><body>';
$message .= '<table rules="all">';
$message .= '<tr style="border: 1px solid black;"><th>User Name</th><th>Password</th></tr>';
$message .= '<tr style="border: 1px solid black;"><td>';
$message .= $_GET['username']; // also tried $username variable
$message .= '</td><td>';
$message .= 'password'; // something generic for now
$message .= '</td></tr>';
$message .= '</table>';
$message .= '<body></html>';
mail($to, $subject, $message, $headers);
}
?>
So right now, when the user clicks the submit button (called #addNewUserSubmit), this page, addUser.php, receives all the values via GET, assigns them to variables, and then should run the MAIL feature, but does nothing. No email is sent (from what I can tell) and none is received.
Does anyone see anything wrong with this code?