So, I have been working on this mail function for the last hour or so, but I can't figure out why it is not sending out the email! I have tried multiple times, altering the code and trying to make it perfect, but still, I have not received the test email...
I have HTML in my email, however, that is not the problem, as I have tested it out without the HTML.
MY PHP:
$to = $register_data['email'];
$subject = "Welcome!";
$body = '
<html>
<head>
<style>
body{
background-color: #FFF;
font-family: arial;
margin: 0;
padding: 0;
}
a{
color: inherit;
text-decoration: none;
}
.outer-email{
width: 80%;
height: auto;
margin: 0 auto;
}
.info-email{
width: 80%;
margin: 120px auto;
}
.outer-header h3{
font-size: 2.9em;
color: #151515;
margin: 0;
}
.inner-email{
margin-top: 20px;
}
.inner-email span{
font-size: 1.3em;
color: #151515;
}
</style>
</head>
<body>
<div class="outer-email">
<div class="info-email">
<div class="outer-header">
<h3>Welcome!</h3>
</div>
<div class="inner-email">
<span>Welcome, $register_data['fname'];
</span>
</div>
</div>
</div>
</body>
</html>
';
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: Domain <noreply@domain.com>';
mail($to, 'Welcome!', $body, $headers);
Please don't class this as a duplicate either, because I have tested ALOT of the other forum questions on this topic, and they didn't solve my problem! :(
Thanks
EDIT: My register function on page:
if(empty($_POST) === false && empty($errors) === true) {
$register_data = array(
'username' => $_POST['username'],
'password' => $_POST['password'],
'fname' => $_POST['fname'],
'lname' => $_POST['lname'],
'email' => $_POST['email'],
'type' => $_POST['type'],
'email_code' => md5($_POST['username'] + microtime())
);
register($register_data, $conn);
redirect('register.php?success');
exit();
} else if (empty($errors) === false) {
echo error_output($errors);
}
UPDATE::
Ok, so I've figured out that if I upload it onto my published server, It does in fact work, so it must've been a problem on my localhost... Thanks @MarkP