I have this Python script:
import whois
w = whois.whois('google.com')
print w
I want to store the results of print to send them via an email.
I have this Python script:
import whois
w = whois.whois('google.com')
print w
I want to store the results of print to send them via an email.
Download yagmail to make your life a lot easier for sending an email.
Run on commandline pip install yagmail
Next, you can easily send an email to yourself like:
import yagmail
import whois
w = whois.whois('google.com')
yag = yagmail.SMTP('yourusername@gmail.com', 'yourpasswrd')
yag.send(contents = str(w))
Note that the default is to send to yourself without a to
argument.
If you want to be explicit you can do:
yag.send('recipient@email.com', "this is the subject", str(w))