PHP code example of mouf / utils.mailer.smtp-mail-service

1. Go to this page and download the library: Download mouf/utils.mailer.smtp-mail-service 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/ */

    

mouf / utils.mailer.smtp-mail-service example snippets


use Mouf\Utils\Mailer\Mail;
use Mouf\Utils\Mailer\SmtpMailService;

// First, let's create the mail object
$mail = new Mail();
$mail->setTitle("My mail");
$mail->setBodyText("This is my mail!");
$mail->setBodyHtml("This is my &lt;b&gt;mail&lt;/b&gt;!");
$mail->setFrom(new MailAddress("[email protected]", "Server"));
$mail->addToRecipient(new MailAddress("[email protected]", "David"));

// Let's get the instance of the service
$mailService = Mouf::getSmtpMailService();

// Finally, we send the mail
$mailService->send($mail);