質問編集履歴
2
読める場合と読めない場合のスクリーンショットを追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -46,4 +46,6 @@
|
|
46
46
|
|
47
47
|
### 補足情報(FW/ツールのバージョンなど)
|
48
48
|
|
49
|
+
|
49
|
-
|
50
|
+

|
51
|
+

|
1
ソースを追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,27 @@
|
|
17
17
|
### 該当のソースコード
|
18
18
|
|
19
19
|
```python
|
20
|
+
parent = MIMEMultipart()
|
21
|
+
body = MIMEText(text, 'plain', 'utf-8')
|
22
|
+
parent.attach(body)
|
23
|
+
|
24
|
+
|
25
|
+
attachment = MIMEBase(type, subtype, encoders='utf-8')
|
26
|
+
file = open(path, 'rt', encoding='utf-8')
|
27
|
+
attachment.set_payload(file.read())
|
20
|
-
|
28
|
+
file.close()
|
29
|
+
encoders.encode_base64(attachment)
|
30
|
+
parent.attach(attachment)
|
31
|
+
attachment.add_header("Content-Disposition","attachment", filename=filename)
|
32
|
+
|
33
|
+
|
34
|
+
parent['Subject'] = Header(subject, charset)
|
35
|
+
parent['From'] = from_address
|
36
|
+
parent['To'] = ",".join(to_address)
|
37
|
+
parent['Date'] = formatdate(localtime=True)
|
38
|
+
|
39
|
+
smtp = smtplib.SMTP('xxx.xxx.xxx.xxx', 25)
|
40
|
+
smtp.sendmail(from_address, to_address + bcc_addrs, parent.as_string())
|
21
41
|
```
|
22
42
|
|
23
43
|
### 試したこと
|