PHP code example of rubricate / mailer

1. Go to this page and download the library: Download rubricate/mailer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rubricate / mailer example snippets


if (extension_loaded('sockets')) {
    echo "Sockets extension is enabled.";
} else {
    echo "Sockets extension is NOT enabled.";
}

if (extension_loaded('openssl')) {
    echo "OpenSSL is enabled (TLS/SSL support)";
} else {
    echo "OpenSSL is NOT enabled";
}


$mailer = new SmtpMailer(
    'smtp.gmail.com', // Host
    587, // Port
    '[email protected]', // User
    'your_password_or_appkey', // Password or App Password
    '[email protected]', // Sender
    'Your Name', // Sender's Name
    true // Enable debugging
);

try {
    $mailer->send(
        '[email protected]', // Recipient
        'Pure SMTP email test', // Subject
        '<h1>Working!</h1><p>This is a test via Rubricate Mailer.</p>', // Body
        true // Send as HTML
    );

    echo "Email sent successfully!";

} catch (Exception $e) {
    echo "Error sending: " . $e->getMessage(); 
}