\n

    This is an HTML<\/b> test email.<\/p>\n <\/body>\n<\/html>\n<\/pre>\n\n\n\n

    ??? ??? ????.
    \n<\/p>\n\n

    [\n  {\n    \"rule\": \"MISSING_MID\",\n    \"score\": 0.1,\n    \"description\": \"Missing Message-Id: header\"\n  },\n  {\n    \"rule\": \"NO_RECEIVED\",\n    \"score\": -0.0,\n    \"description\": \"Informational: message has no Received headers\"\n  },\n  {\n    \"rule\": \"NO_RELAYS\",\n    \"score\": -0.0,\n    \"description\": \"Informational: message was not relayed via SMTP\"\n  },\n  {\n    \"rule\": \"HTML_MESSAGE\",\n    \"score\": 0.0,\n    \"description\": \"BODY: HTML included in message\"\n  },\n  {\n    \"rule\": \"MIME_HTML_ONLY\",\n    \"score\": 0.1,\n    \"description\": \"BODY: Message only has text\/html MIME parts\"\n  },\n  {\n    \"rule\": \"MIME_HEADER_CTYPE_ONLY\",\n    \"score\": 0.1,\n    \"description\": \"'Content-Type' found without required MIME headers\"\n  }\n]\n<\/pre>\n\n\n\n

    \n \n \n API ??? ??\n<\/h2>\n\n

    SpamAssassin? ????? ?????? ??? Linux ??? ?????. ????? ????? EC2 ????? DigitalOcean ???? ??? ? ???, ?? ?? ???? ?? ?? ??? ?? ?? ??? ? ????.<\/p>\n\n

    ???? ???? ?? SpamAssassin? ?? ??? ???? ???? ??? ??? ???? ?? ??? ????.<\/p>\n\n

    ?? Leapcell? ???? SpamAssassin? ?? ??? ???? ???? ??? ???? ????? ??? ? ????. ????? ? ??? ??? ???? ??? ???? ???.<\/p>\n

    Leapcell? API? ???? ?? ?? ????. Linux ??? ???? ???? Dockerfile? ???? ??? ?? ??? ??? ????. ??? Python ???? ???? \"?? ??\" ??? ???? ???? ???.<\/p>\n\n

    \"Build<\/p>\n\n

    ???? ???? ???? ??? ? ?? ?????? ?????. API? ??? ??? SpamAssassin? ???? ???? ??? ?? ? ??? ?????.<\/p>\n\n\n \n\n \n "}

    亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

    ? ??? ?? ??? ???? ??? ???? ?????? ???? API ??

    ??? ???? ?????? ???? API ??

    Dec 23, 2024 pm 10:23 PM

    ??? ??? ???? ??? ? ?? ? ?? ? ??? ???? ?? ??? ?? ?? ???? ????? ???? ????.

    Apache SpamAssassin? ???? ???? ???? ?? ?? ??? ????? ? ??? ??? ??? ?? ???? ?????. ? ?????? SpamAssassin? ???? ???? ???? ????? ??? ???? ???? ??? ???? ??? ???????.
    ??? API? ????? ????? ????? ????? ??? ? ????.

    ? Apache SpamAssassin???

    Apache SpamAssassin? Apache Software Foundation?? ???? ?? ?? ?? ?? ??????. ??? ??, ???? ??? ? ???? ???? ???? ?? ???? ?? "??"? ?????. ????? 5? ??? ???? ???? ??? ??? ????.

    SpamAssassin? ??? ???? ? ????? ???? ?? ???? ???? ?? ??? ?? ?? ??? ????? ??? ???? ???? ???? ?? ????.

    SpamAssassin ????

    SpamAssassin? Linux ????? ????? ???????. ???? ????? Linux OS? ????? Docker VM? ???? ???.

    Debian ?? Ubuntu ?????? ??? ???? SpamAssassin? ?????.

    apt-get update && apt-get install -y spamassassin
    sa-update
    

    sa-update ??? SpamAssassin? ??? ?? ???? ?????.

    ???? ?? ??? ???? SpamAssassin? ??? ??? ??? ? ????. ???? ?? ??? ??? ??? ?? ??? ??? ???? ?? ??? ????? ?????.

    ???? ???? ??? ????.

    spamassassin -t < input_email.txt > results.txt
    

    results.txt?? SpamAssassin? ?? ? ??? ?? ??? ???? ?????.

    FastAPI? ???? SpamAssassin? API? ??

    ???? ??? html_body?? ? ?? ??? ??? ???? ??? API? ??? ?????. ??? SpamAssassin? ???? ?? ??? ?????.

    FastAPI ?? ?

    from fastapi import FastAPI
    from datetime import datetime, timezone
    from email.utils import format_datetime
    from pydantic import BaseModel
    import subprocess
    import re
    
    def extract_analysis_details(text):
        rules_section = re.search(r"Content analysis details:.*?(pts rule name.*?description.*?)\n\n", text, re.DOTALL)
        if not rules_section:
            return []
    
        rules_text = rules_section.group(1)
        pattern = r"^\s*([-\d.]+)\s+(\S+)\s+(.+)$"
        rules = []
        for line in rules_text.splitlines()[1:]:
            match = re.match(pattern, line)
            if match:
                score, rule, description = match.groups()
                rules.append({
                    "rule": rule,
                    "score": float(score),
                    "description": description.strip()
                })
        return rules
    
    app = FastAPI()
    
    class Email(BaseModel):
        subject: str
        html_body: str
    
    @app.post("/spam_check")
    def spam_check(email: Email):
        # assemble the full email
        message = f"""From: example@example.com
    To: recipient@example.com
    Subject: {email.subject}
    Date: {format_datetime(datetime.now(timezone.utc))}
    Content-Type: text/html; charset="UTF-8"
    
    {email.html_body}"""
    
        # Run SpamAssassin and capture the output directly
        output = subprocess.run(["spamassassin", "-t"], 
                                input=message.encode('utf-8'), 
                                capture_output=True)
    
        output_str = output.stdout.decode('utf-8', errors='replace')
        details = extract_analysis_details(output_str)
        return {"result": details}
    

    ???? SpamAssassin ??? ?? ?? ????? ?????.

    ?? ??? ?? ???????.

    subject:
    Test Email
    
    html_body:
    <html>
      <body>
        <p>This is an <b>HTML</b> test email.</p>
      </body>
    </html>
    

    ??? ??? ????.

    [
      {
        "rule": "MISSING_MID",
        "score": 0.1,
        "description": "Missing Message-Id: header"
      },
      {
        "rule": "NO_RECEIVED",
        "score": -0.0,
        "description": "Informational: message has no Received headers"
      },
      {
        "rule": "NO_RELAYS",
        "score": -0.0,
        "description": "Informational: message was not relayed via SMTP"
      },
      {
        "rule": "HTML_MESSAGE",
        "score": 0.0,
        "description": "BODY: HTML included in message"
      },
      {
        "rule": "MIME_HTML_ONLY",
        "score": 0.1,
        "description": "BODY: Message only has text/html MIME parts"
      },
      {
        "rule": "MIME_HEADER_CTYPE_ONLY",
        "score": 0.1,
        "description": "'Content-Type' found without required MIME headers"
      }
    ]
    

    API ??? ??

    SpamAssassin? ????? ?????? ??? Linux ??? ?????. ????? ????? EC2 ????? DigitalOcean ???? ??? ? ???, ?? ?? ???? ?? ?? ??? ?? ?? ??? ? ????.

    ???? ???? ?? SpamAssassin? ?? ??? ???? ???? ??? ??? ???? ?? ??? ????.

    ?? Leapcell? ???? SpamAssassin? ?? ??? ???? ???? ??? ???? ????? ??? ? ????. ????? ? ??? ??? ???? ??? ???? ???.

    Leapcell? API? ???? ?? ?? ????. Linux ??? ???? ???? Dockerfile? ???? ??? ?? ??? ??? ????. ??? Python ???? ???? "?? ??" ??? ???? ???? ???.

    Build an API to Keep Your Marketing Emails Out of Spam

    ???? ???? ???? ??? ? ?? ?????? ?????. API? ??? ??? SpamAssassin? ???? ???? ??? ?? ? ??? ?????.

    ? ??? ??? ???? ?????? ???? API ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

    ? ????? ??
    ? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

    ? AI ??

    Undresser.AI Undress

    Undresser.AI Undress

    ???? ?? ??? ??? ?? AI ?? ?

    AI Clothes Remover

    AI Clothes Remover

    ???? ?? ???? ??? AI ?????.

    Video Face Swap

    Video Face Swap

    ??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

    ???

    ??? ??

    ???++7.3.1

    ???++7.3.1

    ???? ?? ?? ?? ???

    SublimeText3 ??? ??

    SublimeText3 ??? ??

    ??? ??, ???? ?? ????.

    ???? 13.0.1 ???

    ???? 13.0.1 ???

    ??? PHP ?? ?? ??

    ???? CS6

    ???? CS6

    ??? ? ?? ??

    SublimeText3 Mac ??

    SublimeText3 Mac ??

    ? ??? ?? ?? ?????(SublimeText3)

    ???

    ??? ??

    ??? ????
    1597
    29
    PHP ????
    1488
    72
    ???
    ??? ???? ??? ??? ???? ??? Jul 05, 2025 am 02:58 AM

    ???? Python ?? ?? ?????? ?? ????, "??? ?????, ?? ??"? ???? ??? ??? ??? ?? ??? ?????. 1. ???? ?? ? ??? ?? ?????. ?? ???? ?? ??? ???? ??? ? ? ????. ?? ??, Spoke () ?? ???? ??? ??? ?? ??? ?? ????? ?? ??? ??? ????. 2. ???? ?? ???? ??? ??? ?????? Draw () ???? ???? ????? ?? ???? ?? ??? ???? ??? ???? ?? ?? ?? ??? ????? ?? ?? ????? ?? ?????. 3. Python ?? ???? ???????. ?? ???? ??? ???? ?? ???? ??? ????? ??? ?? ???? ??? ???? ????. ??? ??? ??? ???? ? ??? "?? ??"??????. 4. ???? ? ???? ?? ??? ?????

    ??? ??? ? ???? ??????. ??? ??? ? ???? ??????. Jul 05, 2025 am 02:55 AM

    ???? __iter __ () ? __next __ () ???? ???? ?????. ???? ??? ? ??? ????, ?? ???? ?? ??? ??? ???? ?????. 1. ???? ?? () ?? ? ??? ??? ???? ? ?? ??? ?? ? ?? ???? ??? ????. 2. ???? ?? ??? ???? ??? ???? ???? ???? ???? ?? ???? ?????. 3. ???? ???? ?? ??? ?? ? ? ? ??? ?? ? ???????? ? ? ??? ?? ??? ??? ???? ?? ? ? ???? ??????. ?? : ??? ?? ???? ??? ???? ????. ???? ?? ?? ? ??? ?????? ???? ? ?? ?? ? ? ????.

    ????? API ??? ???? ?? ????? API ??? ???? ?? Jul 13, 2025 am 02:22 AM

    API ??? ??? ??? ?? ??? ???? ???? ???? ????. 1. Apikey? ?? ??? ?? ????, ????? ?? ?? ?? URL ?? ??? ?????. 2. Basicauth? ?? ???? ??? Base64 ??? ??? ??? ??? ????? ?????. 3. OAUTH2? ?? Client_ID ? Client_Secret? ?? ??? ?? ?? ?? ??? BearEtroken? ???????. 4. ?? ??? ???? ?? ?? ?? ???? ????? ???? ?? ?? ? ????. ???, ??? ?? ??? ??? ???? ?? ??? ???? ???? ?? ?????.

    ? ?? ? ??? ???? ?? Python ? ?? ? ??? ???? ?? Python Jul 09, 2025 am 01:13 AM

    ????? ??? ? ??? ??? ?? ??? ???? ??? zip () ??? ???? ????.? ??? ?? ??? ???? ?? ??? ?? ????. ?? ??? ???? ?? ?? itertools.zip_longest ()? ???? ?? ?? ? ??? ?? ? ????. enumerate ()? ???? ??? ???? ?? ? ????. 1.zip ()? ???? ????? ?? ??? ??? ??? ?????. 2.zip_longest ()? ???? ?? ??? ?? ? ? ???? ?? ? ????. 3. Enumental (Zip ())? ??? ??? ????? ??? ???? ???? ?? ???? ?? ? ????.

    ??? ?? ??? ?????? ??? ?? ??? ?????? Jul 07, 2025 am 02:55 AM

    typehintsinpythonsolvetheproblemombiguityandpotentialbugsindynamicallytypedcodebyallowingdevelopscifyexpectiontypes. theyenhancereadability, enablearylybugdetection ? improvetoomingsupport.typehintsareaddedusingaColon (:) forvariblesAndAramete

    ??? ???? ?????? ??? ???? ?????? Jul 08, 2025 am 02:56 AM

    inpython, iteratorsareobjectsthatlowloppingthroughcollections __ () ? __next __ ()

    ??? ??? ??????. ??? ??? ??????. Jul 07, 2025 am 12:14 AM

    Assert? ????? ???? ???? ?? ? ???? ??? ???? ??? ?? ?? ????. ??? ??? ??? ?? ??? ?????, ?? ?? ?? ??, ?? ?? ?? ?? ?? ?? ??? ????? ?? ?? ??? ?? ???? ??? ? ??? ??? ??? ??? ?? ???????. ?? ??? ???? ?? ?? ???? ?? ????? ??? ? ????.

    Python Fastapi ???? Python Fastapi ???? Jul 12, 2025 am 02:42 AM

    Python? ???? ????? ???? API? ???? Fastapi? ?????. ?? ??? ?? ????? ?????? ??? ??? ??? ???? ?? ? ? ????. Fastapi ? Asgi Server Uvicorn? ?? ? ? ????? ??? ??? ? ????. ??? ??, ?? ?? ?? ? ???? ?????? API? ???? ?? ? ? ????. Fastapi? ??? HTTP ??? ???? ?? ?? ? Swaggerui ? Redoc Documentation Systems? ?????. ?? ??? ?? URL ?? ??? ?? ? ??? ??, ?? ?? ??? ???? ???? ?? ?? ??? ??? ? ????. Pydantic ??? ???? ??? ?? ???? ???? ????? ? ??? ? ? ????.

    See all articles