PHP code example of the94air / slimo
1. Go to this page and download the library: Download the94air/slimo 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/ */
the94air / slimo example snippets
class MailController extends Controller
{
public function index(Request $request, Response $response, $args)
{
$mailer = $this->mailer;
// Create a message
$message = (new \Swift_Message('Wonderful Subject'))
->setFrom(['[email protected]' => 'John Doe'])
->setTo(['[email protected]', '[email protected]' => 'A name'])
->setBody('Here is the message itself');
// Send the message
$result = $mailer->send($message);
// returns `int(2)` on success
var_dump($result);
}
}