I've been struggling with this the entire day. The server used to work without smtp authentication. Now it doesn't anymore. So I created a mail adress to forward the filled in scripts to my email adress. I used to get errors. Now I'm not getting any errors anymore, but I'm still not getting the any mail.
Maybe you guys can see if there is something wrong with my code.
require_once "Mail.php";
$recipient = "mwmhermans@outlook.com"; //Het email adres van de persoon die vragen moet ontvangen.
$subject = "Dealership request." + $_POST['naam']; //Subject van de mail.
$header = "From: " . $_POST['email'] . "\n";
$mail_body = "Contact script was executed on " . date("d-m-Y") . " at " . date("H:i") . " \n"; // tijd van uitvoering
$mail_body .= "The following person executed the script:\n\n";
$mail_body .= "Name: " . $_POST['naam'] . "\n";
$mail_body .= "E-mail: " . $_POST['email'] . "\n\n";
$mail_body .= "Company: " . $_POST['company'] . "\n";
$host = "";
$username = "";
$password="";
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($recipient, $subject, $header, $body);
echo '<div style="margin-left:25px;"><div class="wrapper">';
echo "<br/><b>Your request is successfully sent.</b><br>You'll get a response as soon as possible.</b><br>";
echo "<a class=\"main\" href='javascript:history.back(1)'>Back</a>";
echo '</div></div>';