Django+jenkins+python+RESTful framework(基于方法的视图) 转发邮件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Django+jenkins+python+RESTful framework(基于方法的视图) 转发邮件相关的知识,希望对你有一定的参考价值。

Send_Email.py



@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(基于方法的视图) 转发邮件的主要内容,如果未能解决你的问题,请参考以下文章

Django+jenkins+python+RESTful framework 转发邮件

Django+jenkins+python+RESTful framework(基于方法的视图) 转发邮件

Django+jenkins+python+RESTful framework(基于Class的视图) 转发邮件

Jenkins部署python项目

linux+jenkins+svn环境搭建以及自动部署django项目构建配置

Jenkins 持续化部署实例