phpmailer versturen naar gmail
Via m´n website verstuur ik mail met behulp van PHPmailer.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
function sendEmail() {
$mail = new PHPMailer;
require_once 'web-mail.php';
$mail->isSMTP();
$mail->Host = $host;
$mail->Port = $port;
$mail->SMTPDebug = $setDebug;
$mail->SMTPAuth = true;
$mail->Username = $user;
$mail->Password = $pass;
$mail->SMTPSecure = $secure;
$mail->From = $from;
$mail->FromName = $fromName;
$mail->addAddress($_POST['email'], $_POST['firstname']);
$mail->addReplyTo($user, $fromName);
$mail->WordWrap = 50;
$mail->CharSet = 'utf-8';
$mail->isHTML(true);
$mail->Subject = 'Mail van website';
$body = 'Naam: ';
$body .= '<br>Email: ';
$body .= '<br>Bericht: ';
$mail->Body = $body;
$mail->AltBody = $body;
if($mail->send()) {
return TRUE;
}
else {
return FALSE;
}
}
?>
function sendEmail() {
$mail = new PHPMailer;
require_once 'web-mail.php';
$mail->isSMTP();
$mail->Host = $host;
$mail->Port = $port;
$mail->SMTPDebug = $setDebug;
$mail->SMTPAuth = true;
$mail->Username = $user;
$mail->Password = $pass;
$mail->SMTPSecure = $secure;
$mail->From = $from;
$mail->FromName = $fromName;
$mail->addAddress($_POST['email'], $_POST['firstname']);
$mail->addReplyTo($user, $fromName);
$mail->WordWrap = 50;
$mail->CharSet = 'utf-8';
$mail->isHTML(true);
$mail->Subject = 'Mail van website';
$body = 'Naam: ';
$body .= '<br>Email: ';
$body .= '<br>Bericht: ';
$mail->Body = $body;
$mail->AltBody = $body;
if($mail->send()) {
return TRUE;
}
else {
return FALSE;
}
}
?>
Laat ik deze mail, via een gepost formulier, sturen naar [email protected] of [email protected] (dus: $_POST['email'][email protected]), dan komt de mail aan.
Stuur ik ´m echter naar $_POST['email'][email protected], dan komt ie niet aan.
Hoe komt dit en is dit te ondervangen?
Op deze url kan je controleren welke records je in je DNS hebt staan: http://www.kitterman.com/spf/validate.html
Als je niet weet hoe je deze (juist) moet configureren raad ik aan om contact te zoeken met je hosting.
Volgens je geadviseerde link lijkt de spf record te kloppen, maar zegt niets over de anderen.
Ik zal contact opnemen met de host, wat ik weet niks van DNS-records. Hopelijk kunnen zij het verhelpen.
SPF heeft meer met Hotmail te maken. Ik meen dat Dmarc meer van toepassing is op Gmail.