coderuday21 commited on
Commit
7392882
·
1 Parent(s): 6383573

Email API: send required FileName and AttachmentBase64 placeholders

Browse files
Files changed (1) hide show
  1. app/notifier.py +3 -3
app/notifier.py CHANGED
@@ -115,13 +115,13 @@ def _send_via_api(recipient: str, subject: str, html_body: str):
115
  url = EMAIL_API_URL.strip()
116
  try:
117
  import requests
118
- # API expects multipart/form-data: ToEmail, Subject, Body, FileName, AttachmentBase64
119
  files = {
120
  "ToEmail": (None, recipient),
121
  "Subject": (None, subject),
122
  "Body": (None, html_body),
123
- "FileName": (None, ""),
124
- "AttachmentBase64": (None, ""),
125
  }
126
  resp = requests.post(
127
  url,
 
115
  url = EMAIL_API_URL.strip()
116
  try:
117
  import requests
118
+ # API requires all fields; use placeholders when no attachment (empty base64 = "")
119
  files = {
120
  "ToEmail": (None, recipient),
121
  "Subject": (None, subject),
122
  "Body": (None, html_body),
123
+ "FileName": (None, "report.html"),
124
+ "AttachmentBase64": (None, "IA=="), # base64 of single space when no attachment
125
  }
126
  resp = requests.post(
127
  url,