python簡單實現註冊自動傳送郵件

2021-09-12 07:38:13 字數 911 閱讀 4994

def register():

if request.method == 'post':

username = request.form.get("username", none)

password = request.form.get('password', none)

# 當所有的資訊遍歷結束, 都沒有發現註冊的使用者存在, 則將註冊的使用者新增到伺服器, 並跳轉登入介面;

for user in users:

if user['username'] == username:

return render_template('register.html', message="使用者%s已經存在" % (username))

else:

flash("使用者%s已經註冊成功, 請登入....." % (username), category='info')

# 指定埠, 預設25, 但qq郵箱預設為 埠號465或587;

to = ['[email protected]', ]

message = 'time:%s \n ip:%s' % (datetime.datetime.now().strftime('%y-%m-%d %h:%m:%s'), socket.gethostbyname(socket.gethostname()))

content = mimetext(message) # mimetext表示郵件傳送具體內容

content['subject'] = 'python郵箱測試'

content['from'] = '[email protected]'

sent.sendmail('[email protected]', to, content.as_string()) # 三個引數

sent.close() # 關閉郵箱

snmp自動發trap的實現

snmp自動發trap note this file originally auto generated by mib2c using mib2c.notify.conf 17838 2009 11 25 20 35 23z magfr include include include include...

python京東序號產生器 京東自動註冊

京東的自動序號產生器,打碼用的打碼兔和qq超人,走京東www的介面,完整專案 import sys import os import time import string import random import pickle import queue import json import requ...

Discuz 如何實現自動註冊登入

本文實現功能 1.從原有系統進入論壇自動登入和註冊 2.實現彈框在本頁面,不進行跳轉 3.js在頁面載入時直接發起註冊請求 這個功能之前使用的uc user register這個函式來處理的,但是今天在開發使用者空間時就會出現問題。在我們原有的系統上新增乙個論壇,但是使用者資訊需要共享。實現方法 在...