2.django中,傳送郵件的案例如下:
from
django.core.mail
import
send_mail
send_mail(
'subject here'
,
'here is the message.'
,
'[email protected]'
,
[
'[email protected]'
], fail_silently
=
false
)
2.2 一次性傳送多個郵件:
1
2
3
4
5
6
7
8
from
django.core.mail
import
send_mass_mail
message1
=
(
'subject here'
,
'here is the message'
,
'[email protected]'
, [
'[email protected]'
,
'[email protected]'
])
message2
=
(
'another subject'
,
'here is another message'
,
'[email protected]'
, [
'[email protected]'
])
send_mass_mail((message1, message2), fail_silently
=
false
)
3.其中,send_email引數中的郵件名:『subject here』和郵件內容:『here is the message』這兩個,單雙引號都可以,
send_mass_mail中,郵件名:『subject here』和郵件內容:『here is the message』,一定是要單引號才行,否則會傳送失敗!
Django傳送郵件
簡介 雖然python提供了smtplib庫,來完成email的傳送功能,但是django對其進行了封裝,使得傳送郵件的介面變得更簡單,更方便,django的封裝位於django.core.mail 例子 from django.core.mail import send mail send mai...
django傳送郵件
django封裝了python自帶的傳送郵件的功能,使其更加簡單易用。1 settings中進行配置 email backend django.core.mail.backends.smtp.emailbackend email use tls true email host smtp.163.co...
Django傳送郵件
django提供了傳送郵件的介面,僅需做簡單的設定即可實現傳送郵件的功能。首先需要在setting做簡單的配置,以163郵箱為例 email backend django.core.mail.backends.smtp.emailbackend email host smtp.163.com ema...