PHP Classes
elePHPant
Icontem

Dframe MyMail: Compose and send email messages using PHPMailer

Recommend this page to a friend!
  Info   View files Example   View files View files (14)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2018-11-28 (9 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 96 All time: 9,266 This week: 319Up
Version License PHP version Categories
mymail 1.0Custom (specified...5Email, PHP 5
Description Author

This package can compose and send email messages using PHPMailer.

It is a simple wrapper around that the PHPMailer library with a function that can send the whole message in a single call.

The class also supports adding one or more files to be attached to the message.

  Performance   Level  
Name: Slawomir Kaleta <contact>
Classes: 6 packages by
Country: Poland Poland
Age: ???
All time rank: 358980 in Poland Poland
Week rank: 177 Up5 in Poland Poland Up

 

Details

Dframe/MyMail

Build Status Latest Stable Version Latest Unstable Version License

Simple mail wrapper using phpmailer

U?ycie

config/myMail.php

<?php
return array(
    'Hosts' => ['example@mail'],      // Specify main and backup SMTP servers
    'SMTPAuth' => true,                    // Enable SMTP authentication
    'Username' => 'Username@mail',         // SMTP username
    'Password' => '',                      // SMTP password
    'SMTPSecure' => 'tls',                 // Enable TLS encryption, `ssl` also accepted
    'Port' => 587,                         // Port

    'setMailTemplateDir' => APP_DIR . 'View/templates/mail',
    'smartyHtmlExtension' => '.html.php',              // Default '.html.php'
    'smartyTxtExtension' => '.txt.php',                // Default '.txt.php'
    'fileExtension' => '.html.php',

    'senderName' => APP_NAME,      // Name of default sender
    'senderMail' => 'senderMail@mail'  // Default sender's address
);

<?php

use Dframe\MyMail\MyMail;
use Dframe\Config;
$view = $this->loadView('index');
$myMail = new MyMail($config = Config::load('myMail')); // Load Configu

/* 
 * If you have problem with ssl in php 5.6 add
 *       $myMail->SMTPOptions = [
 *           'ssl' => [
 *               'verify_peer' => false,
 *               'verify_peer_name' => false,
 *               'allow_self_signed' => true
 *           ]
 *       ];
 */
 
 $myMail->SMTPDebug  = 2; // Enables SMTP debug information (for testing)
                          // 1 = errors and messages
                          // 2 = messages only
		       
$addAddress = ['mail' => $_POST['email'], 'name' => $_POST['firstname']];    // Addresses to send
$view->assign('name', $_POST['firstname']);                                       // Assign template values
$body = $view->fetch('reset');                                                    // Template mail
$mail->send($addAddress, 'Test Mail', $body);

Stalone example#1 php

use \Dframe\MyMail\MyMail;

require_once __DIR__ . '/../vendor/autoload.php';
$config = require_once 'config/config.php'; 
$myMail = new MyMail($config);                                       // Load Config
$addAddress = ['mail' => 'adres@email', 'name' => 'titleFrom']; // Addresses to send
$mail->send($addAddress, 'Test Mail', $body);

Stalone example#2 php

<?php

use Dframe\MyMail\MyMail;

require_once __DIR__ . '/../vendor/autoload.php';
$config = require_once 'config/config.php'; 

$mail = new MyMail(); // Za?adowanie Configu
$mail->mailObject->isSMTP();
$mail->mailObject->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);
//$mail->SMTPDebug  = 2; // Enables SMTP debug information (for testing)
                         // 1 = errors and messages
                         // 2 = messages only
$mail->mailObject->SMTPSecure = false;

$addAddress = ['mail' => 'adres@email', 'name' => 'titleFrom']; // Addresses to send

try {
    $mail->send($addAddress, 'Test Mail', $body);

} catch (Exception $e) {
    echo $e->getMessage();
	
}
  Files folder image Files  
File Role Description
Files folder imageexamples (2 directories)
Files folder imagesrc (1 file)
Files folder imagetests (2 files)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files  /  examples  
File Role Description
Files folder imageexample1 (1 file, 1 directory)
Files folder imageexample2 (1 file, 1 directory)

  Files folder image Files  /  examples  /  example1  
File Role Description
Files folder imageconfig (1 file)
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  examples  /  example1  /  config  
File Role Description
  Accessible without login Plain text file myMail.php Aux. Auxiliary script

  Files folder image Files  /  examples  /  example2  
File Role Description
Files folder imageapp (3 directories)
  Accessible without login Plain text file tables.sql Data Auxiliary data

  Files folder image Files  /  examples  /  example2  /  app  
File Role Description
Files folder imagebin (1 file)
Files folder imageController (1 file)
Files folder imageModel (1 file)

  Files folder image Files  /  examples  /  example2  /  app  /  bin  
File Role Description
  Plain text file CronSmall.php Class Class source

  Files folder image Files  /  examples  /  example2  /  app  /  Controller  
File Role Description
  Plain text file Mail.php Class Class source

  Files folder image Files  /  examples  /  example2  /  app  /  Model  
File Role Description
  Plain text file Mail.php Class Class source

  Files folder image Files  /  src  
File Role Description
  Plain text file MyMail.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file Bootstrap.php Aux. Auxiliary script
  Plain text file SetupTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:96
This week:0
All time:9,266
This week:319Up