Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]通过wordpress使用smtp发邮件时报错 #219

Closed
1 task
KunBuFenZi opened this issue May 9, 2024 · 10 comments
Closed
1 task

[BUG]通过wordpress使用smtp发邮件时报错 #219

KunBuFenZi opened this issue May 9, 2024 · 10 comments

Comments

@KunBuFenZi
Copy link

KunBuFenZi commented May 9, 2024

复现步骤

wp mail smtp插件进行发件测试 smtp服务端收到请求 但报错2024-05-09 08:27:14,128 - main - ERROR - Failed to send mail code=[500] text=[Internal Server Error],不过实际上发送成功,且tempmail站里有记录

预期行为

应无报错

部署方式

  • [*] cli 部署(smtp直接运行的py源码)
  • 用户界面部署

浏览器环境

edge 124.0.2478.80 (正式版本) (64 位)

@dreamhunter2333
Copy link
Owner

可以看下 worker 后台的日志么

@KunBuFenZi
Copy link
Author

可以看下 worker 后台的日志么

看了下 worker好像不记录历史日志 然后我部署wp的那台机子今天被我玩崩了 得等老师去那边开机 开机了我一定第一时间试一下

@KunBuFenZi
Copy link
Author

下面是worker的日志(把ip删了)
{ "outcome": "ok", "scriptVersion": { "id": "32242c1c-a8a0-4fb3-aa80-f65cc8aeb9ce" }, "scriptName": "cloudflare_temp_email", "diagnosticsChannelEvents": [], "exceptions": [], "logs": [ { "message": [ "202 Accepted: null\n" ], "level": "log", "timestamp": 1715331393106 }, { "message": [ "Error: Context is not finalized. You may forget returning Response object or await next()" ], "level": "error", "timestamp": 1715331393639 } ], "eventTimestamp": 1715331391554, "event": { "request": { "url": "https://tempapi.kbfz.cc/external/api/send_mail", "method": "POST", "headers": { "accept": "*/*", "accept-encoding": "gzip, br", "cf-connecting-ip": "", "cf-ipcountry": "JP", "cf-ray": "8818b76d1ecc7362", "cf-visitor": "{\"scheme\":\"https\"}", "connection": "Keep-Alive", "content-length": "3010", "content-type": "application/json", "host": "tempapi.kbfz.cc", "user-agent": "python-requests/2.31.0", "x-forwarded-proto": "https", "x-real-ip": "" }, "cf": { "clientTcpRtt": 1, "longitude": "139.68990", "httpProtocol": "HTTP/1.1", "tlsCipher": "AEAD-AES256-GCM-SHA384", "continent": "AS", "asn": 61112, "clientAcceptEncoding": "gzip, deflate", "country": "JP", "tlsClientExtensionsSha1": "tlH5gnoC5Z1HF45J5OgHEi338V0=", "verifiedBotCategory": "", "tlsClientAuth": { "certIssuerDNLegacy": "", "certIssuerSKI": "", "certSubjectDNRFC2253": "", "certSubjectDNLegacy": "", "certFingerprintSHA256": "", "certNotBefore": "", "certSKI": "", "certSerial": "", "certIssuerDN": "", "certVerified": "NONE", "certNotAfter": "", "certSubjectDN": "", "certPresented": "0", "certRevoked": "0", "certIssuerSerial": "", "certIssuerDNRFC2253": "", "certFingerprintSHA1": "" }, "tlsExportedAuthenticator": { "clientFinished": "398d60001435a5a295c31346e912e3be6707453eb002aa6cad0a9781946afe5baecc5eb9bbb8e153e50f9f3132f3f3a7", "clientHandshake": "fdfdda96a1c5adb0cbbbd3025d2876a8fa47cc890eff8a6ac769bb4961419fd822e40a5d1f32558e1bd5078f47d9314f", "serverHandshake": "e7663a377281e89be9493d3f46ef1c2f63d6116b963c3161ceebcbe094eeede78d1c3d7749f94caa0e536dc33e5388eb", "serverFinished": "6db536130d81f01d2a456fe7e5bb344711715b057975fdd6aa75fb6be928e6c02ffaa721e573d9ae930e49f8ed5e241f" }, "tlsVersion": "TLSv1.3", "city": "Tokyo", "timezone": "Asia/Tokyo", "colo": "NRT", "tlsClientHelloLength": "508", "edgeRequestKeepAliveStatus": 1, "postalCode": "151-0053", "region": "Tokyo", "latitude": "35.68930", "requestPriority": "", "regionCode": "13", "asOrganization": "Akile", "tlsClientRandom": "+5lLQtJL91ltM7lxrLeNJJfcvq464DzY5x1CftIzow4=" } }, "response": { "status": 500 } }, "id": 0 }

此外 还有一个问题 就是wordpress走这里的smtp好像会乱码 而走正常的邮箱smtp不会 下面是同一封邮件走本项目smtp和QQ邮箱smtp发出的内容对比

QQ:
image

本项目:
image

@dreamhunter2333
Copy link
Owner

我修复下,代码有些问题,邮件乱码看起来是变成 Unicode 了,我测试下

@dreamhunter2333
Copy link
Owner

临时加了下 decode 不同 charset 的代码,可以再测试下

@KunBuFenZi
Copy link
Author

KunBuFenZi commented May 11, 2024

换了新的server.py但是 依旧发出的还是乱码
2024-05-11 04:16:49,411 - main - INFO - Starting server settings[proxy_url='xxx' port=8025]
2024-05-11 04:17:19,488 - mail.log - WARNING - Session.login_data is deprecated and will be removed in version 2.0
2024-05-11 04:17:19,761 - main - INFO - handle_DATA from admin@gpus.top to ['xxx']
2024-05-11 04:17:19,763 - main - INFO - Parsed mail from 智慧教师 to {'xxx': ''}
2024-05-11 04:17:19,763 - main - INFO - Send mail {'token': '***', 'from_name': '智慧教师', 'to_name': '', 'to_mail': 'xxx', 'subject': '[智慧教师] 测试邮件', 'is_html': True, 'content': '<style>\r\n\t\t.zibll-email-box .but{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\tborder-radius: 4px;\r\n\t\t\tpadding: 5px 22px;\r\n\t\t\ttext-align: center;\r\n\t\t\tbackground: linear-gradient(135deg, #59c3fb 10%, #268df7 100%) !important;\r\n\t\t\tcolor: #fff !important;\r\n line-height: 1.4;\r\n\t\t\ttext-decoration: none;\r\n\t\t}\r\n\t\t.zibll-email-box img{\r\n\t\t\tmax-width: 100%;\r\n\t\t}\r\n .zibll-email-box img.smilie-icon{\r\n\t\t\tmax-width: 2em;\r\n\t\t}\r\n\t\t.zibll-email-box a{\r\n\t\t\ttext-decoration: none !important;\r\n\t\t}\r\n\t</style>\r\n\t

\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n \r\n\t\t\t\t
\r\n\t\t\t\t

\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\u60a8\u597d\uff01
\u8fd9\u662f\u4e00\u5c01\u6765\u81ea\u667a\u6167\u6559\u5e08[https://test.gpus.top]\u7684\u6d4b\u8bd5\u90ae\u4ef6
\u8be5\u90ae\u4ef6\u7531\u7f51\u7ad9\u540e\u53f0\u53d1\u51fa\uff0c\u5982\u679c\u975e\u60a8\u672c\u4eba\u64cd\u4f5c\uff0c\u8bf7\u5ffd\u7565\u6b64\u90ae\u4ef6
2024-05-11 16:17:19\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\u667a\u6167\u6559\u5e08
\r\n\t\t\t\t\t
\u6b64\u4fe1\u4e3a\u7cfb\u7edf\u90ae\u4ef6\uff0c\u8bf7\u4e0d\u8981\u76f4\u63a5\u56de\u590d\u3002
\r\n\t\t\t\t\t\r\n\t\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n\t\r\n\r\n'}
2024-05-11 04:17:22,037 - main - ERROR - Failed to send mail code=[500] text=[Internal Server Error]

image
image

@dreamhunter2333
Copy link
Owner

换了新的server.py但是 依旧发出的还是乱码 2024-05-11 04:16:49,411 - main - INFO - Starting server settings[proxy_url='xxx' port=8025] 2024-05-11 04:17:19,488 - mail.log - WARNING - Session.login_data is deprecated and will be removed in version 2.0 2024-05-11 04:17:19,761 - main - INFO - handle_DATA from admin@gpus.top to ['xxx'] 2024-05-11 04:17:19,763 - main - INFO - Parsed mail from 智慧教师 to {'xxx': ''} 2024-05-11 04:17:19,763 - main - INFO - Send mail {'token': '***', 'from_name': '智慧教师', 'to_name': '', 'to_mail': 'xxx', 'subject': '[智慧教师] 测试邮件', 'is_html': True, 'content': '<style>\r\n\t\t.zibll-email-box .but{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\tborder-radius: 4px;\r\n\t\t\tpadding: 5px 22px;\r\n\t\t\ttext-align: center;\r\n\t\t\tbackground: linear-gradient(135deg, #59c3fb 10%, #268df7 100%) !important;\r\n\t\t\tcolor: #fff !important;\r\n line-height: 1.4;\r\n\t\t\ttext-decoration: none;\r\n\t\t}\r\n\t\t.zibll-email-box img{\r\n\t\t\tmax-width: 100%;\r\n\t\t}\r\n .zibll-email-box img.smilie-icon{\r\n\t\t\tmax-width: 2em;\r\n\t\t}\r\n\t\t.zibll-email-box a{\r\n\t\t\ttext-decoration: none !important;\r\n\t\t}\r\n\t</style>\r\n\t

\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n \r\n\t\t\t\t
\r\n\t\t\t\t

\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\u60a8\u597d\uff01
\u8fd9\u662f\u4e00\u5c01\u6765\u81ea\u667a\u6167\u6559\u5e08[https://test.gpus.top]\u7684\u6d4b\u8bd5\u90ae\u4ef6
\u8be5\u90ae\u4ef6\u7531\u7f51\u7ad9\u540e\u53f0\u53d1\u51fa\uff0c\u5982\u679c\u975e\u60a8\u672c\u4eba\u64cd\u4f5c\uff0c\u8bf7\u5ffd\u7565\u6b64\u90ae\u4ef6
2024-05-11 16:17:19\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\u667a\u6167\u6559\u5e08
\r\n\t\t\t\t\t
\u6b64\u4fe1\u4e3a\u7cfb\u7edf\u90ae\u4ef6\uff0c\u8bf7\u4e0d\u8981\u76f4\u63a5\u56de\u590d\u3002
\r\n\t\t\t\t\t
\u8bbf\u95ee\u7f51\u7ad9 |\r\n\u8054\u7cfb\u7ad9\u957f
\r\n\t\t\t\t
\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n\t\r\n\r\n'}
2024-05-11 04:17:22,037 - main - ERROR - Failed to send mail code=[500] text=[Internal Server Error]
image image

看起来是编码问题,我复现下看看怎么修复

@dreamhunter2333
Copy link
Owner

更新了main分支的代码,我测试没问题了,麻烦测试下

@KunBuFenZi
Copy link
Author

更新了main分支的代码,我测试没问题了,麻烦测试下

好的 谢谢 我今晚试试

@KunBuFenZi
Copy link
Author

更新了main分支的代码,我测试没问题了,麻烦测试下

可以了! 谢谢大佬!!!!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants