appwrite icon indicating copy to clipboard operation
appwrite copied to clipboard

🐛 Bug Report: BCC / CC Require Name

Open EVDOG4LIFE opened this issue 1 year ago • 0 comments

👟 Reproduction steps

Attempting to add a BCC target leaves a message stuck in processing, and throws an error in the messaging worker container.

Example code:

try:
    # Prepare the email parameters
    message_id = ID.unique()
    subject = 'Test Subject'
    content = 'This is a test email.'
    send_email_users = []  
    bcc_ids = ['testerid']  

    # Send the email
    message = messaging.create_email(
        message_id=message_id,
        subject=subject,
        content=content,
        topics=[''],         # Optional
        users=send_email_users,
        targets=[],        # Optional
        cc=[],             # Optional
        bcc=bcc_ids,       # BCC recipients
        draft=False,       # Optional
        html=False,        # Optional
        scheduled_at=None  # Optional
    )
    print('Email sent successfully:', message)
except Exception as e:
    print('Error sending email:', e)

Message successfully creates, but remains processing. 

👍 Expected behavior

Message sends and targets are Carbon/Blind copied.

👎 Actual Behavior

Error thrown in https://github.com/utopia-php/messaging/blob/6e466d3511981291843c6ebf9ce3f44fc75e37b0/src/Utopia/Messaging/Messages/Email.php#L46-L57:

Fatal error: Uncaught InvalidArgumentException: Each recipient in bcc must have a name and email in /usr/src/code/vendor/utopia-php/messaging/src/Utopia/Messaging/Messages/Email.php:57

due to worker only passing the email:

https://github.com/appwrite/appwrite/blob/52700f12c2b74943039ce8533485778c445775f2/src/Appwrite/Platform/Workers/Messaging.php#L564-L582

🎲 Appwrite version

Appwrite Cloud

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

EVDOG4LIFE avatar Sep 26 '24 23:09 EVDOG4LIFE