Python中文
首页
教程
问答
标签
搜索
登录
注册
詹戈。使用应用程序发送电子邮件
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我启动了一个新的应用程序gmail并在中配置了设置设置.py用我的gmail帐户</p> <p>我刚到django,不知道如何给我的网站用户发送电子邮件</p> <p>我想创建一个链接,当我打开它,我的用户将得到一个消息从我</p> <p>我编辑过视图.py但我不知道我的函数“wyslij”应该返回什么</p> <pre><code>from django.shortcuts import render from django.core.mail import send_mail from django.contrib.auth.decorators import user_passes_test from django.contrib.auth.models import User from userprofile.models import UserProfile @user_passes_test(lambda u: u.is_superuser) # Create your views here. def wyslij(request): # Create the HttpResponse object with the appropriate PDF headers. uzyt = UserProfile.objects.all().order_by('user_id') for z, uzyt in enumerate(UserProfile.objects.all()): send_mail('The exam is comming', 'Hi, Your exam will be tomorrow!', 'santa.claus.for.grace@gmail.com', [uzyt.email], fail_silently=False) return response </code></pre> <p>在网址.py你知道吗</p> <pre><code>from django.conf.urls.defaults import patterns, include, url urlpatterns = patterns('', url(r'^accounts/wyslij/$', 'gmail.views.wyslij'), ) </code></pre>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p><a href="https://docs.djangoproject.com/en/1.7/topics/email/" rel="nofollow">https://docs.djangoproject.com/en/1.7/topics/email/</a></p> <p>一定要命名你的电子邮件变量和.git忽略你的设置文件</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在python中从数据帧列中删除分类值?
4 回答
如何在python中从数据帧列表中删除引号
4 回答
如何在python中从数据帧创建列表
10 回答
如何在Python中从数据帧创建嵌套的JSON
7 回答
如何在Python中从数据帧显示wordcloud
7 回答
如何在Python中从数据帧的时间戳中删除字符
8 回答
如何在Python中从数据帧绘制简单绘图?
10 回答
如何在python中从数据帧行提取具有特定长度的范围?
6 回答
如何在python中从数据帧设置dict中的值
1 回答
如何在Python中从数据库中获得一个结果
10 回答
如何在python中从数据框中绘制分类条形图
1 回答
如何在Python中从数据框中选择特定细节?
2 回答
如何在python中从数据集中删除unicode
9 回答
如何在python中从数据集中删除某些数值?
2 回答
如何在python中从数据集中选择行
2 回答
如何在Python中从数组中删除元素
3 回答
如何在python中从数组中删除单个倒逗号?
1 回答
如何在python中从数组中删除对象?
5 回答
如何在python中从数组中删除引号
1 回答
如何在python中从数组中删除所有最小值
4 回答