Skip to content

Latest commit

 

History

History
190 lines (123 loc) · 5.51 KB

MailApi.md

File metadata and controls

190 lines (123 loc) · 5.51 KB

RMoore\Truenas\MailApi

All URIs are relative to https://truenas.local/api/v2.0.

Method HTTP request Description
mailGet() GET /mail
mailPut() PUT /mail
mailSendPost() POST /mail/send

mailGet()

mailGet()

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\MailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $apiInstance->mailGet();
} catch (Exception $e) {
    echo 'Exception when calling MailApi->mailGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

mailPut()

mailPut($mail_update0)

Update Mail Service Configuration. fromemail is used as a sending address which the mail server will use for sending emails. outgoingserver is the hostname or IP address of SMTP server used for sending an email. security is type of encryption desired. smtp is a boolean value which when set indicates that SMTP authentication has been enabled and user/pass are required attributes now.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\MailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$mail_update0 = new \RMoore\Truenas\Model\MailUpdate0(); // \RMoore\Truenas\Model\MailUpdate0

try {
    $apiInstance->mailPut($mail_update0);
} catch (Exception $e) {
    echo 'Exception when calling MailApi->mailPut: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
mail_update0 \RMoore\Truenas\Model\MailUpdate0 [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

mailSendPost()

mailSendPost($mail_send)

Sends mail using configured mail settings. text will be formatted to HTML using Markdown and rendered using default E-Mail template. You can put your own HTML using html. If html is null, no HTML MIME part will be added to E-Mail. If attachments is true, a list compromised of the following dict is required via HTTP upload: - headers(list) - name(str) - value(str) - params(dict) - content (str) [ { "headers": [ { "name": "Content-Transfer-Encoding", "value": "base64" }, { "name": "Content-Type", "value": "application/octet-stream", "params": { "name": "test.txt" } } ], "content": "dGVzdAo=" } ] A file might be uploaded to this endpoint. To upload a file, please send a multipart request with two parts. The first, named data, should contain a JSON-encoded payload, and the second, named file, should contain an uploaded file.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\MailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$mail_send = new \RMoore\Truenas\Model\MailSend(); // \RMoore\Truenas\Model\MailSend

try {
    $apiInstance->mailSendPost($mail_send);
} catch (Exception $e) {
    echo 'Exception when calling MailApi->mailSendPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
mail_send \RMoore\Truenas\Model\MailSend [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]