PHP code example of salad-dressing / mailer

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

    

salad-dressing / mailer example snippets


use Salad\Dressing\Mailer\Sender;

public function index()
{
    $this->sender = new Sender;
    $this->sender->addRecipient("[email protected]");
    $this->sender->setSubject("SaladStack Email Test");
    $this->sender->setBody("This is a test email.");
    if($this->sender->send()){
      echo "Email Sent!";
    } else {
      echo "Sending failed.";
    }
}

use Salad\Dressing\Mailer\Sender;

public function index()
{
    $this->sender = new Sender;
    $this->sender->addRecipient("[email protected]");
    $this->sender->setSubject("SaladStack Email Test");
    //adding true on the 2nd params will enable html body
    $this->sender->setBody("<h1>This is a test email.</h1>", true); 
    if($this->sender->send()){
      echo "Email Sent!";
    } else {
      echo "Sending failed.";
    }
}