Skip to content

Commit

Permalink
Resolves #6625
Browse files Browse the repository at this point in the history
- enables no auth for SMTP
  • Loading branch information
schnaker85 authored and Regli Daniel committed Feb 11, 2025
1 parent ce3ead6 commit ba23d35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/my-website/docs/proxy/config_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,12 @@ router_settings:
| SLACK_DAILY_REPORT_FREQUENCY | Frequency of daily Slack reports (e.g., daily, weekly)
| SLACK_WEBHOOK_URL | Webhook URL for Slack integration
| SMTP_HOST | Hostname for the SMTP server
| SMTP_PASSWORD | Password for SMTP authentication
| SMTP_PASSWORD | Password for SMTP authentication (do not set if SMTP does not required auth)
| SMTP_PORT | Port number for SMTP server
| SMTP_SENDER_EMAIL | Email address used as the sender in SMTP transactions
| SMTP_SENDER_LOGO | Logo used in emails sent via SMTP
| SMTP_TLS | Flag to enable or disable TLS for SMTP connections
| SMTP_USERNAME | Username for SMTP authentication
| SMTP_USERNAME | Username for SMTP authentication (do not set if SMTP does not required auth)
| SPEND_LOGS_URL | URL for retrieving spend logs
| SSL_CERTIFICATE | Path to the SSL certificate file
| SSL_VERIFY | Flag to enable or disable SSL certificate verification
Expand Down
11 changes: 3 additions & 8 deletions litellm/proxy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2322,12 +2322,6 @@ async def send_email(receiver_email, subject, html):
if smtp_host is None:
raise ValueError("Trying to use SMTP, but SMTP_HOST is not set")

if smtp_username is None:
raise ValueError("Trying to use SMTP, but SMTP_USERNAME is not set")

if smtp_password is None:
raise ValueError("Trying to use SMTP, but SMTP_PASSWORD is not set")

# Attach the body to the email
email_message.attach(MIMEText(html, "html"))

Expand All @@ -2337,8 +2331,9 @@ async def send_email(receiver_email, subject, html):
if os.getenv("SMTP_TLS", "True") != "False":
server.starttls()

# Login to your email account
server.login(smtp_username, smtp_password) # type: ignore
# Login to your email account only if smtp_username and smtp_password are provided
if smtp_username and smtp_password:
server.login(smtp_username, smtp_password) # type: ignore

# Send the email
server.send_message(email_message)
Expand Down

0 comments on commit ba23d35

Please sign in to comment.