• 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)),
    ]
     
  • 相关阅读:
    计算机网络学习笔记——计算机网络概述
    基础续一
    Python基础一
    linux lvm的操作手册_pvcreate_vgcreate_lvcreate_相关
    Oracle Linux 挂载存储
    MegaCLI SAS RAID Management Tool
    DELL RACADM 批量升级戴尔IDRAC固件
    LSI MegaCli 命令使用4
    LSI MegaCli 命令使用2
    LSI MegaCl i命令使用1
  • 原文地址:https://www.cnblogs.com/QAZLIU/p/5748214.html
Copyright © 2020-2023  润新知