擅长:python、mysql、java
<p>SMTP是一个很好的模块,但用户不太友好。在</p>
<p><a href="https://github.com/kootenpv/yagmail" rel="nofollow">yagmail</a>试图让一切变得简单一点。在</p>
<p>在你的情况下,我会使用:</p>
<pre><code>import yagmail
yag = yagmail.Connect('username', 'password')
with open("msg.csv", "rb") as csvfile:
csv_reader = csv.reader(csvfile)
csv_reader.next()
for line in csv_reader:
for name, email, message in line.strip().split(','):
yag.send(email, subject = name, contents = message)
</code></pre>