teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

fix bug

2024/10/16 10:01

投稿

melian
melian

スコア21234

answer CHANGED
@@ -13,7 +13,7 @@
13
13
  r"C:\Users\User\Desktop\Test4.xlsx",
14
14
  ]
15
15
 
16
- def send_mail_with_attachments(to, subject, body, attachments):
16
+ def send_mail_with_attachments(to, subject, body, *attachments):
17
17
  global outlook
18
18
  # メールオブジェクトの作成
19
19
  mail = outlook.CreateItem(0) # 0:メール
@@ -33,7 +33,7 @@
33
33
 
34
34
  if os.path.isfile(excel_files[0]):
35
35
  if os.path.isfile(excel_files[1]):
36
- send_mail_with_attachments("送信アドレス", "Test1-2", "Test本文1-2", excel_files[:2])
36
+ send_mail_with_attachments("送信アドレス", "Test1-2", "Test本文1-2", *excel_files[:2])
37
37
  else:
38
38
  send_mail_with_attachments("送信アドレス", "Test1", "Test本文1", excel_files[0])
39
39