Email

This page explains the functionality of sending emails using AWS SES.

Prerequisites

Before using this function, ensure that the following AWS credentials and configurations are set as environment variables:

  • AWS_ACCESS_KEY_ID: Your AWS Access Key ID. This key is required for authenticating requests to AWS services.

  • AWS_SECRET_ACCESS_KEY: Your AWS Secret Access Key. This key is used in conjunction with the Access Key ID to securely authenticate AWS requests.

  • AWS_REGION: The AWS region where your resources are located (e.g., ap-northeast-2). If not specified, the default region is set to ap-northeast-2.

These environment variables must be correctly configured in your system or application runtime environment to successfully authenticate and interact with AWS services.

Parameters

  • sender (str): The sender's email address. Must be an email registered with Amazon SES.

  • recipient (str or list): The recipient's email addresses.

  • subject (str): The subject line of the email.

  • body (str): The content of the email body.

  • cc_addresses (list, optional): A list of email addresses to be included as CC (carbon copy) recipients.

  • attachments (list, optional): A list of file paths for attachments to include in the email.

  • addon_subject (str, optional): Additional text to append to the email subject.

Exmaple

from finter.utils.email import send_email
send_email('sender@example.com', ['recipient@example.com'], 
           'hello,μ•ˆλ…•,Xin chΓ o', 'Hello Finter', 
            cc_addresses=['cc@example.com'], attachments=['my_attch.pdf'])

Last updated