2015-07-19 33 views
-3

打印域名註冊的返回數據我有這樣的Python腳本:存儲在Python

import whois 
w = whois.whois('google.com') 
print w 

我想存儲打印的結果通過郵件形式發送。

+0

你嘗試過什麼到目前爲止?你可以在這裏看到如何通過Python發送電子郵件http://stackoverflow.com/questions/64505/發送郵件從 - 蟒蛇-使用,SMTP –

回答

0

下載yagmail使您的生活更容易發送電子郵件。在命令行pip install yagmail

下一頁

運行,你可以輕鬆地發送一封郵件給自己喜歡的:

import yagmail 
import whois 
w = whois.whois('google.com') 

yag = yagmail.SMTP('[email protected]', 'yourpasswrd') 
yag.send(contents = str(w)) 

注意,默認是發送給自己沒有to說法。

如果你想成爲明確的,你可以這樣做:

yag.send('[email protected]', "this is the subject", str(w)) 
0

您已將結果存儲在w中。