For those who may find it useful. This script will run fine on Python 3.4 with these changes.
save_string = "F:\\result\\email_" + str(x) + ".txt"
myfile.write(str(body))
.
Just change the directory and the folder name according to your need. Thanks to the original code provider.