# SMTP

The SecuMailer SMTP API is available at `mail-relay.secumail.cloud`. Connections are available on port `25` and port `587`.&#x20;

{% hint style="info" %}
Connections must use TLS v1.1 or higher.
{% endhint %}

The SMTP API uses SASL for authentication. SecuMailer will provide you with an username and password for the connection.

### Example

The following example shows how a connection can be made using PHPMailer, a popular mailer package for PHP.

```
$mail = new PHPMailer(true);

try {
    //Server settings
    $mail->isSMTP();                                    // Send using SMTP
    $mail->Host       = 'mail-relay.secumail.cloud';    // Set the SMTP server to send through
    $mail->SMTPAuth   = true;                           // Enable SMTP authentication
    $mail->Username   = 'user@example.com';             // SMTP username
    $mail->Password   = 'secret';                       // SMTP password
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption
    $mail->Port       = 587;                            // TCP port to connect to

    //Recipients
    $mail->setFrom('from@example.com', 'Mailer');
    $mail->addAddress('joe@example.net', 'Joe User');    // Add a recipient

    // Content
    $mail->isHTML(true);                                 // Set email format to HTML
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.secumailer.com/manuals/api/smtp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
