SMTP

SecuMailer SMTP API

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

Connections must use TLS v1.1 or higher.

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}";
}

Last updated