I got a mailscript which sends the mail (since $mail->send()
returns true) and I also got headers which are all looking fine. No error is being shown so I am assuming everything is working, but somehow my mail never arrives anywhere. Not on gmail and not on outlook. What could be the issue? I have sent some test mails from another domain on the same server which works fine.
The domain I am sending from is brand new so I doubt it is blacklisted or something similair.
My html form:
<form id="contact-form" class="contact-form" method="post" action="mail/mail_send.php" role="form">
<div class="error-container"></div>
<input type="text" placeholder="Naam *" class="name form-control-name" name="name" required>
<input type="email" placeholder="E-mail *" class="email form-control-email" name="email" required>
<input style="width:100%;" type="text" placeholder="Telefoonnummer" class="phone form-control-phone" name="phone">
<textarea name="message" placeholder="Bericht *" class="message form-control-message" rows="8" cols="20" required></textarea>
<input type="submit" name="submit" value="Verzenden">
</form>
My ajax script:
$('#contact-form').submit(function(){
var $form = $(this),
$error = $form.find('.error-container'),
action = $form.attr('action');
$error.slideUp(750, function() {
$error.hide();
var $name = $form.find('.form-control-name'),
$email = $form.find('.form-control-email'),
$phone = $form.find('.form-control-phone'),
$message = $form.find('.form-control-message');
$.post(action, {
name: $name.val(),
email: $email.val(),
phone: $phone.val(),
message: $message.val()
},
function(data){
$error.html(data);
$error.slideDown('slow');
if (data.match('success') != null) {
$name.val('');
$email.val('');
$phone.val('');
$message.val('');
}
}
);
});
My PHP mail script:
<?PHP
require_once("../phpMailer/class.phpmailer.php");
$isValid = true;
if(isset($_POST['name']) && isset($_POST['mail']) && isset($_POST['phone']) && isset($_POST['message']))
{
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$subject = 'Er is een aanvraag op de website van website\'s Hairdesign';
$mail = new PHPMailer;
$mail->From = $email;
$mail->FromName = $name;
$mail->addAddress("my-email@outlook.com");
$mail->isHTML(true);
$mail->Subject = $subject;
$texts = 'Er is een aanvraag op de website van website\'s Hairdesign<br /> <br />
<b>Naam:</b> '.$name.'<br />
<b>E-mail adres:</b> '.$email.'<br />
<b>Telefoonnummer:</b> '.$phone.'<br />
<b>Bericht:</b> '.$message.'<br /><br /><br />
';
$handtekening = '
<table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-family:calibri;color: #5C5C5C; font-size:10pt;line-height:22px;">
<tr>
<td width="160" valign="top" style="font-family:calibri;padding-left:10px;padding-top:20px;">
[contents]
</td>
</tr>
<tr>
<td width="160" valign="top" style="font-family:calibri;padding-left:10px;padding-top:20px;">
Helpdesk<br>
<b>website\'s Hairdesign</b><br>
<p></p>
</td>
</tr>
</table>
<table height="120" border="0" width="100%" cellspacing="0" cellpadding="0" style="font-family:calibri;color: #5C5C5C; font-size:10pt;line-height:22px;">
<tr>
<td width="250" valign="top" style="font-family:calibri;padding-left:10px;padding-top:20px;border-top: 1px #000000 dotted; border-bottom: 1px #000000 dotted;">
E:
<a href="mailto:info@websiteshairdesign.nl" style="font-family:calibri;color: #5C5C5C; text-decoration: none; border-bottom: 1px #5C5C5C dotted;">info@websiteshairdesign.nl</a><br>
T:
<a href="tel:+310181506451" style="font-family:calibri;color: #5C5C5C; text-decoration: none; border-bottom: 1px #5C5C5C dotted;">+31-(0)181-506451</a><br>
W:
<a href="http://websiteshairdesign.nl/" style="font-family:calibri;color: #5C5C5C; text-decoration: none; border-bottom: 1px #5C5C5C dotted;" target="_blank">www.podlogistics.nl</a><br>
</td>
<td align="right" style="font-family:calibri;padding-right:10px;padding-top:5px;border-top: 1px #000000 dotted; border-bottom: 1px #000000 dotted;">
<a href="http://websiteshairdesign.nl/" target="_blank" title="Ga naar de website">
<img src="http://websitemedia.nl/_extern/websites/img/logo-websites.png" alt="Ga naar de website" style="font-family:calibri;text-align:right;margin:0px;padding:10px 0 10px 0;" border="0" width="232">
</a>
</td>
</tr>
<tr>
<td colspan="2" style="font-family:calibri;color:#a3a3a3;font-size:11px;margin-top:6px;line-height:14px;">
<br>Dit e-mailbericht is uitsluitend bestemd voor de geadresseerde. Als dit bericht niet voor u bestemd is, wordt u vriendelijk verzocht dit aan de afzender te melden. website\'s Hairdesign staat door de elektronische verzending van dit bericht niet in voor de juiste en volledige overbrenging van de inhoud, noch voor tijdige ontvangst daarvan. Voor informatie over website\'s Hairdesign raadpleegt u <a href="http://websiteshairdesign.nl/" style="font-family:calibri;color: #5C5C5C; text-decoration: none; border-bottom: 1px #5C5C5C dotted;" target="_BLANK">website\'s Hairdesign</a>.<br><br>
</td>
</tr>
</table>';
$contents = preg_replace('/\[contents]/',$texts, $handtekening);
$mail->msgHTML($contents);
$mail->AltBody = $texts;
if(!$mail->send())
{
$isValid = false;
}
$mail = new PHPMailer;
$mail->From = 'info@websiteshairdesign.nl';
$mail->FromName = 'website\'s Hairdesign';
$mail->addAddress($email);
$mail->isHTML(true);
$mail->Subject = 'Bedankt voor uw aanvraag bij website\'s Hairdesign';
$texts = 'Geachte heer/mevrouw '.$naam.',<br /><br />
Hartelijk dank voor uw aanvraag, wij zullen hier zo spoedig mogelijk op reageren.<br />
<br>
Met vriendelijke groet,
';
$contents = preg_replace('/\[contents]/',$texts, $handtekening);
$mail->msgHTML($contents);
$mail->AltBody = $texts;
if(!$mail->send())
$isValid = false;
}
if($isValid == true) {
$result = 'Bedankt voor uw aanvraag! Wij nemen z.s.m. contact met u op.';
} else {
$result = 'Vul alle velden in!';
}
echo $result;