workmail-salesforce-python/src/email_utils.py [72:87]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def update_workmail(message_id, content):
    bucket = os.getenv('UPDATED_EMAIL_BUCKET')
    if not bucket:
        raise ValueError("UPDATED_EMAIL_BUCKET not set in environment. Please follow https://docs.aws.amazon.com/lambda/latest/dg/env_variables.html to set it")

    key = str(uuid.uuid4());
    s3.put_object(Body=content.as_bytes(), Bucket=bucket, Key=key)
    s3_reference = {
        'bucket': bucket,
        'key': key
    }
    content = {
        's3Reference': s3_reference
    }
    workmail_message_flow.put_raw_message_content(messageId=message_id, content=content)
    logger.info("Updated email sent to WorkMail successfully")
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



workmail-update-email/src/utils.py [146:175]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def update_workmail(message_id, content):
    """
    Uploads the updated message to an S3 bucket in your account and then updates it at WorkMail via
    PutRawMessageContent API.
    Reference: https://docs.aws.amazon.com/workmail/latest/adminguide/update-with-lambda.html
    Parameters
    ----------
    message_id: string, required
        message_id of the email to download
    content: email.message.Message, required
         EmailMessage representation the updated email
    Returns
    -------
    None
    """
    bucket = os.getenv('UPDATED_EMAIL_BUCKET')
    if not bucket:
        raise ValueError("UPDATED_EMAIL_BUCKET not set in environment. Please follow https://docs.aws.amazon.com/lambda/latest/dg/env_variables.html to set it")

    key = str(uuid.uuid4());
    s3.put_object(Body=content.as_bytes(), Bucket=bucket, Key=key)
    s3_reference = {
        'bucket': bucket,
        'key': key
    }
    content = {
        's3Reference': s3_reference
    }
    workmail_message_flow.put_raw_message_content(messageId=message_id, content=content)
    logger.info("Updated email sent to WorkMail successfully")
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



