PHP Classes

Dframe MyMail: Compose and send email messages using PHPMailer

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 140 All time: 9,211 This week: 140Up
Version License PHP version Categories
dframe-mymail 2.0.0Custom (specified...7Email, 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.

Picture of Slawomir Kaleta
  Performance   Level  
Name: Slawomir Kaleta <contact>
Classes: 16 packages by
Country: Poland Poland
Age: ???
All time rank: 230953 in Poland Poland
Week rank: 43 Up1 in Poland Poland Up
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Example

<?php

use Dframe\MyMail\MyMail;

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

$mail = new MyMail($config); // Za?adowanie Configu
$mail->mailObject->isSMTP();
$mail->mailObject->SMTPOptions = [
   
'ssl' => [
       
'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' => 'Title From']; // Adresy na jakie ma wys?a?

try {
   
$mail->send($addAddress, 'Test Mail', 'Hello Word!');
} catch (
Exception $e) {
    echo
$e->getMessage();
}


Details

Dframe/MyMail

Build Status Latest Stable Version Latest Unstable Version License

Simple mail wrapper using phpmailer

Composer

$ composer require dframe/mymail

Usage

Standalone 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' => 'Title From']; // Addresses to send
$MyMail->send($addAddress, 'Test Mail', $body);

Standalone example#2 php

<?php

use Dframe\MyMail\MyMail;

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

$MyMail = new MyMail($config); // Za?adowanie Configu
$MyMail->mail->isSMTP();
$MyMail->mail->SMTPOptions = array(
    'ssl' => array(
        '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
$MyMail->mail->SMTPSecure = false;

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

try {
    $MyMail->send($addAddress, 'Test Mail', 'Hello Word!');

} catch (Exception $e) {
    echo $e->getMessage();
	
}

Example #1 with Dframe Framework

config/myMail.php - here

<?php

use Dframe\MyMail\MyMail;
use Dframe\Component\Config\Config;
$view = $this->loadView('index');
$MyMail = new MyMail(Config::load('myMail')->get()); // 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
$MyMail->send($addAddress, 'Test Mail', $body);


  Files folder image Files (17)  
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 MIGRATION_1.1_to_2.0.md Example Example script
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 (17)  /  examples  
File Role Description
Files folder imageexample1 (1 file, 1 directory)
Files folder imageexample2 (1 file, 1 directory)

  Files folder image Files (17)  /  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 (17)  /  examples  /  example1  /  config  
File Role Description
  Accessible without login Plain text file myMail.php Aux. Auxiliary script

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

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

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

  Files folder image Files (17)  /  examples  /  example2  /  app  /  Config  
File Role Description
  Accessible without login Plain text file myMail.php Aux. Auxiliary script

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

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

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

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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:140
This week:0
All time:9,211
This week:140Up