这个上面说的很明白:http://dikar.iteye.com/blog/308934
是由于代码缩进出了问题。
解决方法是:后面加上'\'字符。
比如:
mailbody = 'From:tomhanks@king.com\r\n'
+ 'To:wangwangwang@qq.com\r\n'
+ 'Subject: say hello\r\n\r\n'
+ 'i want to say, you name is really good.\r\n'
这个是会出现错误的。按照我的方法后,改为:
mailbody = 'From:tomhanks@king.com\r\n' \
+ 'To:wangwangweang@qq.com\r\n' \
+ 'Subject: say hello\r\n\r\n' \
+ 'i want to say, you name is really good.\r\n'