G
G
graduate students @graduate2021-03-19 04:53:33
PHP
graduate students @graduate, 2021-03-19 04:53:33

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;


mail test:

R_DKIM_NA
Spam Score: 1.5
DKIM record dns not found
RCVD_NO_TLS_LAST
Spam Score: 0.1
Last hop did not use encrypted transports
BROKEN_CONTENT_TYPE
Spam Score: 1.5
Message has part with broken content type
SUBJECT_NEEDS_ENCODING
Spam Score: 1
Subject needs encoding
MISSING_MIME_VERSION
Spam Score: 2
MIME-Version header is missing
R_MISSING_CHARSET
Spam Score: 2.5
Charset is missing in a message

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
ZardoZAntony, 2021-03-31
students

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.

G
galaxy, 2021-03-19
@galaxy

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:

  • no Content-type and charset
  • headers are not encoded properly
  • no mime version

Also no transfer-encoding is specified.
No DKIM (although this is already a trifle). It is not known what is with the SPF of the domain.

S
Sanes, 2021-03-19
@Sanes

https://www.mail-tester.com/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question