首页 > 代码库 > Django+jenkins+python+RESTful framework(3) 转发邮件
Django+jenkins+python+RESTful framework(3) 转发邮件
Django的设置:
project 下的settings.py 文件中加入以下配置信息:
EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend‘
EMAIL_USE_TLS = False
EMAIL_HOST = ‘xx‘
EMAIL_PORT = 25
EMAIL_HOST_USER = ‘‘
EMAIL_HOST_PASSWORD = ‘‘
DEFAULT_FROM_EMAIL = ‘xx‘
url.py 的文件中加入
urlpatterns = [
url(r‘^sendmail/$‘, send_emails.sendEmail,name=‘sendMails‘),
]
完整代码:
"""SendMail URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r‘^$‘, views.home, name=‘home‘)
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r‘^$‘, Home.as_view(), name=‘home‘)
Including another URLconf
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r‘^blog/‘, include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from testEmail.test import Send_Email
urlpatterns = [
url(r‘^sendmail/$‘, send_emails.sendEmail,name=‘sendMails‘),
url(r‘^admin/‘, include(admin.site.urls)),
]
Django+jenkins+python+RESTful framework(3) 转发邮件
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。