Skip to content

Commit 299e1f3

Browse files
committed
Fixed email sender problem. Username now required.
1 parent 26e14a2 commit 299e1f3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

email/1.3.0/api.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ actions:
5252
description: The SMTP login username
5353
multiline: false
5454
example: "[email protected]"
55-
required: false
55+
required: true
5656
schema:
5757
type: string
5858
- name: password

email/1.3.0/src/app.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def send_email_smtp(self, smtp_host, recipient, subject, body, smtp_port, attach
104104
else:
105105
return {
106106
"success": False,
107-
"reason": f"General auth exception: {e}"
107+
"reason": f"General login exception: {e}"
108108
}
109109

110110
except smtplib.SMTPAuthenticationError as e:
@@ -123,6 +123,12 @@ def send_email_smtp(self, smtp_host, recipient, subject, body, smtp_port, attach
123123
self.logger.info("Pre mime multipart")
124124
msg = MIMEMultipart()
125125
msg["From"] = username
126+
if len(username) == 0:
127+
return {
128+
"success": False,
129+
"reason": "No username provided (sender). Please provide a username."
130+
}
131+
126132
msg["To"] = recipient
127133
msg["Subject"] = subject
128134

0 commit comments

Comments
 (0)