标签:基于 add tor from etc chm email post result
Send_Email.py
class SendEmailViewList(BaseViewList):
def __init__(self):
super(SendEmailViewList, self).__init__(None)
def post(self, request, format=None):
data = getRequestBody(request)
print type(data)
emailServer = data.get(‘emailServer‘)
user = data.get(‘fromUser‘)
passwd = data.get(‘frompasswd‘)
recipients = data.get(‘toRecipients‘)
startSendEmail(emailServer, user, passwd, *recipients)
return Response({‘result‘: ‘Have send Emails‘}, status=200)
@api_view([‘POST‘])
def sendEmail(request):
data = getRequestBody(request)
print type(data)
emailServer = data.get(‘emailServer‘)
user = data.get(‘fromUser‘)
passwd = data.get(‘frompasswd‘)
recipients = data.get(‘toRecipients‘)
startSendEmail(emailServer,user,passwd,*recipients)
return Response({‘result‘:‘Have send Emails‘},status=200)
def startSendEmail(emailServer,fromUser,frompasswd,*toRecipients):
from django.conf import settings
settings.EMAIL_HOST_USER = fromUser
settings.EMAIL_HOST_PASSWORD = frompasswd
server = FetchMail(emailServer, fromUser, frompasswd)
content = server.getLatestEmailContent()
detailsContent = server.getDetailsContent(content)
subject = server.getSubject(content)
address = server.getAddress(content)
send_mail(subject, detailsContent, address, toRecipients, html_message=detailsContent)
Django+jenkins+python+RESTful framework(基于Class的视图)(4) 转发邮件
标签:基于 add tor from etc chm email post result
原文地址:http://www.cnblogs.com/QAZLIU/p/5748230.html