mailgun#

Description#

Mailgun integration.

Configuration#

mailgun:
  # [Required]
  # Mailgun API secret key.
  api_key:   # type=str

  # [Optional]
  # Use ``https://api.eu.mailgun.net/v3`` if you are using an EU account.
  # api_base_url: https://api.mailgun.net/v3  # type=str

  # [Optional]
  # Default registered domain that should be used for sending
  # emails if not specified in the `MailgunPlugin.send <https://docs.platypush.tech/platypush/plugins/mailgun.html#platypush.plugins.mailgun.MailgunPlugin.send>`_ action.
  # domain:   # type=Optional[str]

  # [Optional]
  # Default timeout for the requests (default: 20 seconds).
  # timeout: 20.0  # type=float

Actions#

Module reference#

class platypush.plugins.mailgun.MailgunPlugin(api_key: str, api_base_url: str = 'https://api.mailgun.net/v3', domain: str | None = None, timeout: float = 20.0, **kwargs)[source]#

Bases: Plugin

Mailgun integration.

__init__(api_key: str, api_base_url: str = 'https://api.mailgun.net/v3', domain: str | None = None, timeout: float = 20.0, **kwargs)[source]#
Parameters:
  • api_key – Mailgun API secret key.

  • api_base_url – Use https://api.eu.mailgun.net/v3 if you are using an EU account.

  • domain – Default registered domain that should be used for sending emails if not specified in the send() action.

  • timeout – Default timeout for the requests (default: 20 seconds).

send(to: str | Sequence[str], from_: str | None = None, cc: str | Sequence[str] | None = None, bcc: str | Sequence[str] | None = None, subject: str = '', body: str = '', body_type: str = 'plain', domain: str | None = None, **kwargs)[source]#

Send an email through Mailgun.

Parameters:
  • domain – From which registered domain the email(s) should be sent (default: the domain specified in the plugin configuration).

  • to – Receiver(s), as comma-separated strings or list.

  • from – Sender email address (from is also supported outside of Python contexts).

  • cc – Carbon-copy addresses, as comma-separated strings or list

  • bcc – Blind carbon-copy addresses, as comma-separated strings or list

  • subject – Mail subject.

  • body – Mail body.

  • body_type – Mail body type - text or html.