PHP code example of lucinda / mailing

1. Go to this page and download the library: Download lucinda/mailing 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/ */

    

lucinda / mailing example snippets


$message = new \Lucinda\Mail\Message("test subject", "<p>Hello, <strong>world</strong>!</p>");
$message->setMessageID("example.com"); // recommended to prevent message being labeled as spam
$message->setDate(time()); // signals that message was written now
$message->setContentType("text/html", "UTF-8"); // recommended, unless message is ASCII plaintext
$message->addTo(new Address("[email protected]")); // mandatory
$message->setReplyTo(new Address("[email protected]", "John Doe")); // recommended if message can be replied to
$message->send();

$message->addAttachment("/foo/bar/baz.jpg");

$message->setFrom(new \Lucinda\Mail\Address("[email protected]", "Example.com Team"));

$message->setSender(new \Lucinda\Mail\Address("[email protected]", "Example.com Team"));

$message->setReplyTo(new \Lucinda\Mail\Address("[email protected]", "Example.com Team"));

$message->addTo(new \Lucinda\Mail\Address("[email protected]"));

$message->addCC(new \Lucinda\Mail\Address("[email protected]"));

$message->addBCC(new \Lucinda\Mail\Address("[email protected]"));

$message->setContentType("text/html", "UTF-8");

$message->setDate(time()-1000);

$message->setMessageID("example.com");

$message->setSignature("-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY-----", "", "example.com", "dkim", [
    "From",
    "Reply-To",
    "Subject",
    "To"
]);

$message->addCustomHeader("List-Unsubscribe", "<mailto: [email protected]>");

$message->send();