-3

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.

Brian Tompsett - 汤莱恩
  • 5,195
  • 62
  • 50
  • 120
  • What have you tried so far?, you can see here how to send email via python http://stackoverflow.com/questions/64505/sending-mail-from-python-using-smtp – omri_saadon Jul 19 '15 at 10:50

2 Answers2

0

You already have your results stored in w.

Daniel
  • 39,063
  • 4
  • 50
  • 76
0

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))
PascalVKooten
  • 18,070
  • 15
  • 82
  • 140