Evo Voice

<back to all web services

SendTestEmail

Send a test email from the specified account

Requires Authentication
Requires any of the roles:SystemAdministrator, Manager, Customer
The following routes are available for this service:
POST/settings/test-email
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class EmailAccount implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var string|null */
        public ?string $server=null,
        /** @var string|null */
        public ?string $userName=null,
        /** @var int */
        public int $port=0,
        /** @var string|null */
        public ?string $emailAddress=null,
        /** @var string|null */
        public ?string $displayName=null,
        /** @var string|null */
        public ?string $password=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['server'])) $this->server = $o['server'];
        if (isset($o['userName'])) $this->userName = $o['userName'];
        if (isset($o['port'])) $this->port = $o['port'];
        if (isset($o['emailAddress'])) $this->emailAddress = $o['emailAddress'];
        if (isset($o['displayName'])) $this->displayName = $o['displayName'];
        if (isset($o['password'])) $this->password = $o['password'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->server)) $o['server'] = $this->server;
        if (isset($this->userName)) $o['userName'] = $this->userName;
        if (isset($this->port)) $o['port'] = $this->port;
        if (isset($this->emailAddress)) $o['emailAddress'] = $this->emailAddress;
        if (isset($this->displayName)) $o['displayName'] = $this->displayName;
        if (isset($this->password)) $o['password'] = $this->password;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Send a test email from the specified account */
// @Api(Description="Send a test email from the specified account")
class SendTestEmail implements IPost, JsonSerializable
{
    public function __construct(
        /** @description The email account to send from */
        // @ApiMember(Description="The email account to send from")
        /** @var EmailAccount|null */
        public ?EmailAccount $account=null,

        /** @description The user to send to */
        // @ApiMember(Description="The user to send to")
        /** @var string|null */
        public ?string $emailAddress=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['account'])) $this->account = JsonConverters::from('EmailAccount', $o['account']);
        if (isset($o['emailAddress'])) $this->emailAddress = $o['emailAddress'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->account)) $o['account'] = JsonConverters::to('EmailAccount', $this->account);
        if (isset($this->emailAddress)) $o['emailAddress'] = $this->emailAddress;
        return empty($o) ? new class(){} : $o;
    }
}

PHP SendTestEmail DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /settings/test-email HTTP/1.1 
Host: team.evovoice.io 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"account":{"id":"String","server":"String","userName":"String","port":0,"emailAddress":"String","displayName":"String","password":"String"},"emailAddress":"String"}