Class Recipient

The Recipient class is used to configure a recipient which can be used as sender, to, cc, bcc or reply-to in the message.

To see some usage examples you can look at the page Usage examples.

Constructor

class Recipient(name: str,
                address: str)

Arguments

  • name: optional name for the recipient.
  • address: string recipient email address.

Usage example

import mumailer

recipient = mumailer.Recipient(name='Muflone',
                               address='muflone@example.com')
message.sender = recipient

Method parse

Recipient.parse(address: str)

The static method parse can be used to create a new Recipient object from a string representation in the form “Name email@address” or just “email@address”.

Arguments

  • address: string recipient representation.

Returns

  • The method returns a new Recipient object.

Usage example

recipient = mumailer.Recipient.parse(address='Muflone Ovinis muflone@example.com')
message.reply_to = recipient

Method parse_as_list

Recipient.parse_as_list(addresses: list[str])

The static method parse_as_list can be used to get a list of Recipient objects from a list of string representations in the form “Name email@address” or just “email@address”.

Arguments

  • addresses: list of string recipient representation.

Returns

  • The method returns a list of Recipient objects.

Usage example

recipients = mumailer.Recipient.parse_as_list(addresses=[
    'Muflone Ovinis muflone@example.com',
    'foo@example.com'])
message.to = recipients