3
저는 Python을 사용하여 gmail 계정으로 전자 메일을 보내고 있습니다.Gmail은 전자 메일의 HTML과 텍스트 및 HTML 부분을 모두 표시합니다.
이 HTML
입니다이 텍스트
입니다 : I는 다음과 같이 표시되는 HTML 및 텍스트 버전을 모두 Gmail에서 이메일을 볼 때 이것은 내가msg = email.mime.multipart.MIMEMultipart()
msg['From'] = '[email protected]'
msg['To'] = '[email protected]'
msg['Subject'] = 'HTML test'
msg_html = email.mime.text.MIMEText('<html><head></head><body><b>This is HTML</b></body></html>', 'html')
msg_txt = email.mime.text.MIMEText('This is text','plain')
msg.attach(msg_html)
msg.attach(msg_txt)
#SNIP SMTP connection code
smtpConn.sendmail('[email protected]', '[email protected]', msg.as_string())
을 사용하고 코드입니다
텍스트 또는 HTML을 표시해야하며,이 동작의 원인은 무엇입니까?
메일 링하고있는 콘텐츠를보세요. 이것은 Gmail이 렌더링되는 방식이 아닌 보내는 메일에 대한 문제입니다. – ControlAltDel