Processing method of high spam rate in HTML format

Source: Internet
Author: User

Original e-Mail used content-type:text/html

The following is the X-spam score, when the score more than 6 points are treated as junk mail

X-spam-status:yes, score=6.3 required=6.0 tests=content_type_present,Directunknown, Html_message,mime_html_only,only1hopdirect,rdns_none,TO_NO_BRKTS_FROM_MSSP, To_no_brkts_nordns_html,uribl_blocked,utf8 autolearn=No version=3.3.1X-spam-report: *0.0uribl_blocked ADMINISTRATOR notice:the query to URIBL was BLOCKED.    * See Http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block * For more information. *      [URIs:handbook.jp]    * -0.1content_type_present Exists:content-type *0.3Directunknown directly received spam from suspicious dynamic IP *1.0Only1hopdirect Only1hopdirect *1.0html_message body:html included in MESSAGE *0.4mime_html_only body:message only have text/html MIME parts *-0.1 UTF8 Raw:utf-8Message body *1.3Rdns_none delivered to internal network by a host with no RDNS *2.5TO_NO_BRKTS_FROM_MSSP Multiple formatting errors *0.0 to_no_brkts_nordns_html to:misformatted and NO RDNS and HTML only

The solution is to use content-type:multipart/alternative

This type can send two types of mail text/plain and text/html at the same time, greatly reducing the score of the message

The following is a multipart/alternative of this type of score because it is less than 6 points without x-spam-report

X-spam-status:no, score=3.5 required=6.0 tests=content_type_present,    directunknown, HTML_MESSAGE, Multipart_alternative,only1hopdirect,rdns_none,    uribl_blocked, UTF8 autolearn=no version=3.3.1

Here is the specific code

functionSendalternativemail ($to,$from,$subject,$plainmessage,$htmlmessage,$BCC=NULL,$CC=NULL) {    $to= Base64 ($to); $from= Base64 ($from); $subject= ' =? UTF-8? B? '.Base64_encode($subject) . '? = '; $boundary=uniqid(' NP ');
Set Header$headers= "mime-version:1.0\r\n"; $headers. = "From:".$from." \ r \ n "; $CC&&$headers. = "Cc:$CC\ n "; $BCC&&$headers. = "BCC:$BCC\ n "; $headers. = "Content-type:multipart/alternative;boundary=".$boundary. "\ r \ n"; Set Plain Body$message= "\r\n\r\n--".$boundary. "\ r \ n"; $message. = "content-type:text/plain;charset=utf-8\r\n\r\n"; $message.=$plainmessage; Set HTML body$message. = "\r\n\r\n--".$boundary. "\ r \ n"; $message. = "content-type:text/html;charset=utf-8\r\n\r\n"; $message.=$htmlmessage; End$message. = "\r\n\r\n--".$boundary. "--"; return Mail($to,$subject,$message,$headers);}
encode email address functionBase64 ($string){ if(!$string) { return NULL; } $array=Explode(‘,‘,$string); foreach($array as&$a) { $a=Trim($a); if(Preg_match('/(. *) (<[^>][email protected][^>]+>) $/u ',$a,$match)) { $a= ' =? UTF-8? B? '.Base64_encode($match[1]). '? = '.$match[2]; } } return implode(‘,‘,$array);}

Reference: http://krijnhoetmer.nl/stuff/php/html-plain-text-mail/

Processing method of high spam rate in HTML format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.