mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-06-18 02:59:07 +00:00
Update smtp.py
This commit is contained in:
parent
493d5dcb5f
commit
e8c9f3ceb1
12
smtp.py
12
smtp.py
|
@ -98,16 +98,22 @@ class CaterpillarSMTPServer(SMTPServer):
|
||||||
to = v
|
to = v
|
||||||
|
|
||||||
# build a data
|
# build a data
|
||||||
_, raw_data = jsonrpc2_encode('relay_sendmail', {
|
proxy_data = {
|
||||||
|
'headers': {
|
||||||
|
"User-Agent": "php-httpproxy/0.1.5 (Client; Python " + python_version() + "; Caterpillar; abuse@catswords.net)",
|
||||||
|
},
|
||||||
|
'data': {
|
||||||
"to": to,
|
"to": to,
|
||||||
"from": mailfrom,
|
"from": mailfrom,
|
||||||
"subject": subject,
|
"subject": subject,
|
||||||
"message": data.decode('utf-8')
|
"message": data.decode('utf-8')
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
_, raw_data = jsonrpc2_encode('relay_sendmail', proxy_data['data'])
|
||||||
|
|
||||||
# send HTTP POST request
|
# send HTTP POST request
|
||||||
try:
|
try:
|
||||||
response = requests.post(server_url, data=raw_data, auth=auth)
|
response = requests.post(server_url, headers=proxy_data['headers'], data=raw_data, auth=auth)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
type, id, method, rpcdata = jsonrpc2_decode(response.text)
|
type, id, method, rpcdata = jsonrpc2_decode(response.text)
|
||||||
if rpcdata['success']:
|
if rpcdata['success']:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user