PHP code example of sciactive / umailphp

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

    

sciactive / umailphp example snippets


// After creating the \MyApp\VerifyEmailDefinition class, which extends
// \uMailPHP\Definition, you can use it like this:

// Define any macros, and be sure to escape them with htmlspecialchars.
$link = htmlspecialchars('https://example.com/userVerify?secret='.$someSecret);
$macros = [
  'verify_link' => $link,
  'start_date' => htmlspecialchars(\uMailPHP\Mail::formatDate(
      $user->startDate,
      'date_med',
      '',
      $user->timezone
  )),
  'to_phone' => htmlspecialchars(\uMailPHP\Mail::formatPhone($user->phone)),
  'to_group' => htmlspecialchars($user->group->name)
];
// Create the mail object. Second argument can either be an email address or an
// object with an 'email' property.
$mail = new \uMailPHP\Mail('\MyApp\VerifyEmailDefinition', $user, $macros);
// Send mail.
if (!$mail->send()) {
  throw new \Exception('Email failed.');
}