Skip to content

Commit

Permalink
Fixed recipient list format
Browse files Browse the repository at this point in the history
  • Loading branch information
rapuckett authored Dec 19, 2024
1 parent 66049bb commit 3b30eb7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .github/scripts/send_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,15 @@ def create_email_body(repo_name, stats):
# except Exception as e:
# print(f"Error sending email: {e}")

def send_email(recipient_emails, subject, body):
def send_email(recipient_emails_str, subject, body):
"""Send email using SendGrid to multiple recipients"""
sg = SendGridAPIClient(os.environ['SENDGRID_API_KEY'])

from_email = Email(os.environ['SENDER_EMAIL'])

# Convert string to list if a single string is provided
if isinstance(recipient_emails, str):
recipient_emails = [recipient_emails]
# Split comma-separated string into list and strip whitespace
recipient_emails = [email.strip() for email in recipient_emails_str.split(',')]

# Create personalization object with multiple recipients
mail = Mail(
from_email=from_email,
subject=subject,
Expand Down

0 comments on commit 3b30eb7

Please sign in to comment.