feat: smtp_proxy_server use httpx (#265)

This commit is contained in:
Dream Hunter
2024-05-22 22:24:59 +08:00
committed by GitHub
parent 02e3e755e7
commit aa04dc4efa
3 changed files with 11 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
import asyncio
import logging
import email
import requests
import httpx
from aiosmtpd.controller import Controller
from aiosmtpd.smtp import SMTP, Session, Envelope, AuthResult, LoginPassword
@@ -102,7 +102,7 @@ class CustomSMTPHandler:
}
_logger.info(f"Send mail {dict(send_body, token='***')}")
try:
res = requests.post(
res = httpx.post(
f"{settings.proxy_url}/external/api/send_mail",
json=send_body, headers={
"Content-Type": "application/json"