def METHOD_NAME(self, queue_message):
    try:
        sendgrid_delivery = SendGridDelivery(self.config, self.session, self.logger)
        email_messages = sendgrid_delivery.get_to_addrs_sendgrid_messages_map(queue_message)
        if "smtp_server" in self.config:
            smtp_delivery = SmtpDelivery(
                config=self.config, session=self.session, logger=self.logger
            )
            for to_addrs, message in email_messages.items():
                self.logger.info(
                    "Sending message to SMTP server, {}.".format(self.config["smtp_server"])
                )
                smtp_delivery.send_message(message=message, to_addrs=list(to_addrs))
        else:
            self.logger.info("Sending message to Sendgrid.")
            return sendgrid_delivery.sendgrid_handler(queue_message, email_messages)
    except Exception as error:
        self.logger.exception(error)