2017-04-18 17:28:55 +02:00
|
|
|
from django.http import HttpRequest, HttpResponse
|
|
|
|
|
|
|
|
from zerver.decorator import internal_notify_view
|
|
|
|
from zerver.lib.email_mirror import mirror_email_message
|
2020-06-11 00:54:34 +02:00
|
|
|
from zerver.lib.request import REQ, has_request_variables
|
2017-04-18 17:28:55 +02:00
|
|
|
from zerver.lib.response import json_error, json_success
|
|
|
|
|
|
|
|
|
|
|
|
@internal_notify_view(False)
|
|
|
|
@has_request_variables
|
2020-06-05 23:35:52 +02:00
|
|
|
def email_mirror_message(
|
2021-02-12 08:19:30 +01:00
|
|
|
request: HttpRequest,
|
|
|
|
rcpt_to: str = REQ(),
|
|
|
|
msg_base64: str = REQ(),
|
2020-06-05 23:35:52 +02:00
|
|
|
) -> HttpResponse:
|
|
|
|
result = mirror_email_message(rcpt_to, msg_base64)
|
2017-04-18 17:28:55 +02:00
|
|
|
if result["status"] == "error":
|
|
|
|
return json_error(result['msg'])
|
|
|
|
return json_success()
|