Sending profiles tell Gophish which SMTP servers to use when sending emails.
The SMTP endpoint allows you to create, view, and manage Gophish sending profiles.
This example shows how to retrieve the name of every sending profile in Gophish.
from gophish import Gophishapi_key = 'API_KEY'api = Gophish(api_key)for smtp in api.smtp.get():print smtp.name
A sending profile contains the server address/port, and optional credentials.
id (int) The smtp ID
name (str) The smtp name
interface_type (str) The type of SMTP connection (for now, always use
host (str) The host:port of the SMTP server
from_address (str) The address to send emails from (e.g. John Doe <[email protected]>)
ignore_cert_errors (bool) Whether or not to ignore SSL certificate validation errors (set to
true in the case of self-signed certificates)
modified_date (optional: datetime.datetime) The datetime this SMTP profile was previously modified
__init__(self, **kwargs) - Returns a new SMTP object
Gets the details for one or more sending profiles. To get a particular sending profiles, set the ID to the profile ID.
smtp_id is not set, all sending profiles owned by the current user will be returned.
smtp_id is set:
Creates a new sending profile. This endpoint requires you to submit a
gophish.models.SMTP object that was created.
Edits an existing sending profile. This endpoint requires you to submit an existing
gophish.models.SMTP object with its
id attribute set correctly.
gophish.models.SMTP object that was edited.
Deletes the sending profile specified by
Here are some examples to show how to use the API.
All of these examples assume the following setup:
from gophish import Gophishfrom gophish.models import *api_key = 'API_KEY'api = Gophish(api_key)
smtp = api.smtp.get()
smtp = api.smtp.get(smtp_id=1)
smtp = SMTP(name='Test SMTP')smtp.host = "localhost:25"smtp.from_address = "John Doe <[email protected]>"smtp.interface_type = "SMTP"smtp.ignore_cert_errors = Truesmtp = api.smtp.post(smtp)print smtp.id