PHP code example of germania-kg / swiftmailer-callable
1. Go to this page and download the library: Download germania-kg/swiftmailer-callable 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/ */
germania-kg / swiftmailer-callable example snippets
use Germania\SwiftMailerCallable\SwiftMailerCallable;
// Dependencies
$swift_mailer = Swift_Mailer::newInstance( ... );
$message_factory = function() { return Swift_Message::newInstance( ... ); });
// Setup callable, optionally with PSR-3 Logger
$mailer = new SwiftMailerCallable( $swift_mailer, $message_factory );
$mailer = new SwiftMailerCallable( $swift_mailer, $message_factory, $logger );
// PSR-3 LoggerAwareInterface
$mailer->setLogger( $logger );
// Prepare sending
$subject = 'My mail subject';
$body = 'Any mail text';
// Go! - Optionally pass recipient, if not already set in factory
$sent = $mailer( $subject, $body );
$sent = $mailer( $subject, $body, ['[email protected]' => 'Joen Doe'] );