Answer the question
In order to leave comments, you need to log in
What needs to be added to SMTP to pass antispam?
In general, mail.ru and yandex.ru are sent to spam ... Google, everything is ok.
function SendMail ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $to, $from, $subject, $body, $name) {
$SmtpUser= base64_encode($SmtpUser);
#Пароль авторизации на сервера SMTP
$SmtpPass= base64_encode($SmtpPass);
if ($SMTPIN = fsockopen ($SmtpServer, $SmtpPort, $errno, $errstr, 3)) {
var_dump($errno);
var_dump($errstr);
fputs ($SMTPIN, "EHLO ".$SmtpServer."\r\n");
$talk["hello"] = fgets ( $SMTPIN, 4096 );
fputs($SMTPIN, "AUTH LOGIN\r\n");
$talk["login"]=fgets($SMTPIN,4096);
fputs($SMTPIN, $SmtpUser."\r\n");
$talk["user"]=fgets($SMTPIN,4096);
fputs($SMTPIN, $SmtpPass."\r\n");
$talk["pass"]=fgets($SMTPIN,4096);
fputs ($SMTPIN, "MAIL FROM: <".$from.">\r\n");
$talk["from"] = fgets ( $SMTPIN, 4096 );
fputs ($SMTPIN, "RCPT TO: <".$to.">\r\n");
$talk["to"] = fgets ($SMTPIN, 4096);
fputs($SMTPIN, "DATA\r\n");
$talk["data"]=fgets( $SMTPIN,4096 );
fputs($SMTPIN, "TO: <".$to.">\r\nFROM: <".$name.">\r\nSUBJECT: ".$subject."\r\n\r\n\r\n".$body."\r\n.\r\n");
$talk["send"]=fgets($SMTPIN,4096);
fputs ($SMTPIN, "QUIT\r\n");
$talk["quit"]=fgets($SMTPIN,4096);
fclose($SMTPIN);
} else {
return false;
}
var_dump ($talk);
return $talk;
Answer the question
In order to leave comments, you need to log in
I'm checking
spamtest.smtp.bz
at https://www.mail-tester.com/ everything is great, but in fact spamtest.smtp.bz showed that IP timeweb is banned. Changing hosting solved the problem.
Without DKIM, very often it gets into spam.
DKIM, SPF, DMARC - this is what needs to be configured right away.
What's the fun of writing smtp by hand? PHPMailer or mail() at the worst did not please?
Forming a letter correctly is not a trivial task, full of small nuances.
However, the main things were listed for you:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question