0
다음 코드를 사용하여 전자 메일 첨부 파일을 보내려고합니다. 하지만 오류가 발생합니다. 첨부 파일이 없으면 완벽하게 작동합니다. 이 코드의 문제점은 무엇입니까?Python을 사용하여 전자 메일 첨부 파일 보내기
당신은 앞 줄에 닫는 괄호를 놓치고있는 것 같습니다"mail5.py", line 14
smtpObj = smtplib.SMTP('domain', 25)
^
SyntaxError: invalid syntax
#!/usr/bin/python
import smtplib
sender = '[email protected]'
receivers = ['[email protected]']
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
msg = MIMEMultipart()
msg.attach(MIMEText(file("text.txt").read())
smtpObj = smtplib.SMTP('domain', 25)
smtpObj.sendmail(sender, receivers, msg.as_string())
print "Successfully sent email"
msg.attach (MimeText는 (파일 ("text.txt")를 읽고()). <- 여기에 괄호가 없습니다. – rajpy