PHP code example of marko / mail-smtp
1. Go to this page and download the library: Download marko/mail-smtp 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/ */
marko / mail-smtp example snippets
use Marko\Mail\Contracts\MailerInterface;
use Marko\Mail\Message;
class OrderNotifier
{
public function __construct(
private MailerInterface $mailer,
) {}
public function notifyShipment(string $email, string $trackingNumber): void
{
$message = Message::create()
->to($email)
->from('[email protected]', 'Store')
->subject('Your order has shipped')
->html("<p>Tracking: $trackingNumber</p>");
$this->mailer->send($message);
}
}