For the complete documentation index, see llms-docs.txt or the site index llms.txt. Full docs corpus: llms-full-docs.txt. Prefer the markdown version of this page at /docs/examples/smtp/php.md. Product capabilities: skill.md. Docs MCP: /docs/mcp. Site MCP: /mcp.

PHP

Send emails via Reloop SMTP using PHPMailer in PHP.

PHPMailer SMTP Integration

Use the popular PHPMailer library to send transactional emails via Reloop.

View complete runnable example on GitHub ↗

Installation

Install PHPMailer via Composer:

composer require phpmailer/phpmailer

Code Example

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer(true);

try {
    // Server settings
    $mail->isSMTP();
    $mail->Host       = 'smtp.reloop.sh';
    $mail->SMTPAuth   = true;
    $mail->Username   = 'reloop';
    $mail->Password   = getenv('RELOOP_API_KEY');
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
    $mail->Port       = 465;

    // Recipients
    $mail->setFrom('onboarding@reloop.sh', 'Onboarding');
    $mail->addAddress('delivered@resend.dev');

    // Content
    $mail->isHTML(true);
    $mail->Subject = 'Hello from PHPMailer';
    $mail->Body    = '<p>Congrats on sending your first email via Reloop SMTP using PHPMailer!</p>';

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

Was this page helpful?

Edit this page