Python3でsmtp.logを使ってGmailでメールを出そうとすると「AttributeError: module 'smtplib' has no attribute 'SMTP'」と言われます。何が悪いか教えてください。
C:\Users\cf\Dropbox\Public\Algobuilder_Fukazawa\gadgets\batchMailer\Resources>type batchMailerOne.py
#! /usr/bin/env python3
#
# batchMailerOne.py
# -*- coding: utf-8 -*-
#### START CUSTOMIZATION ####
smtp_host = 'smtp.gmail.com'
smtp_port = 587
from_email = 'foo <foo@example.com>'
mail_subject = 'bar'
user_name = 'xxxxx no such mail xxxxxxxxxx@gmail.com' # Gmail login name
user_password = 'xxxxxxxxx' # Gmail psswd (2 steps authorization is not supported)
# set mail address surrounded in double quote, ended with comma (you can send up to 100 mails a day)
to_emails = [
"recipient1 <recipient1@example.com>",
"recipient2 <recipient2@example.com>",
"recipient3 <recipient2@example.com>",
]
# write your message between ''' and '''
message_text = '''
Dear someone,
Hello
'''
### END CUSTOMIZATION ###
from email import message
import smtplib
server = smtplib.SMTP(smtp_host, smtp_port)
server.ehlo()
server.starttls()
server.ehlo()
server.login(user_name, user_password)
for to_email in to_emails:
msg = message.EmailMessage()
msg.set_content(message_text)
msg['Subject'] = mail_subject
msg['From'] = from_email
msg['To'] = to_email
server.send_message(msg)
server.quit()
C:\Users\cf\>batchMailerOne.py
Traceback (most recent call last):
File "C:\Users\cf\batchMailerOne.py", line 31, in <module>
import smtplib
File "C:\Users\cf\Anaconda3\lib\smtplib.py", line 49, in <module>
import email.generator
File "C:\Users\cf\Anaconda3\lib\email\generator.py", line 14, in <module>
from copy import deepcopy
File "C:\Users\cf\Anaconda3\lib\copy.py", line 60, in <module>
from org.python.core import PyStringMap
File "C:\Users\cf\batchMailerOne.py", line 39, in <module>
server = smtplib.SMTP(smtp_host, smtp_port)
AttributeError: module 'smtplib' has no attribute 'SMTP'
C:\Users\cf>\Users\cf\Anaconda3\python.exe -V
Python 3.6.3 :: Anaconda, Inc.
よろしくおねがいします。