2017 © Pedro Peláez
 

library jv-mail

A generic module send e-mail for ZF2.

image

jaimevalasek/jv-mail

A generic module send e-mail for ZF2.

  • Thursday, September 26, 2013
  • by jaimevalasek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 37 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

JVMail - JV Mail

Create By: Jaime Marcelo Valasek, (*1)

Use this module to send emails from your website., (*2)

Futures video lessons can be developed and published on the website or Youtube channel http://www.zf2.com.br/tutoriais http://www.youtube.com/zf2tutoriais, (*3)

Installation

Download this module into your vendor folder., (*4)

After done the above steps, open the file config / application.config.php. And add the module with the name JVMail., (*5)

Using the JVMail

  • Add and configure the code below into the file that is module.config.php
  • Authentication Options 'transportSsl' and type of connection between ssl and tls
'JVMail' => array(
    'transport' => array(
        'smtpOptions' => array(
            'host' => 'smtp.domain.com',
            'port' => 587,
            'connection_class' => 'plain',
            'connection_config' => array(
                'username' => 'user@domain.com',
                'password' => 'password',
                'from' => 'anyemail@domain.com'
            ),
        ),
        'transportSsl' => array(
            'use_ssl' => false,
            'connection_type' => 'tls' // ssl, tls
        ),
    ),
    'options' => array(
        'type' => 'text/html',
        'html_encoding' => \Zend\Mime\Mime::ENCODING_8BIT,
        'message_encoding' => 'UTF8'
    )
),

how to use

  • You need to create the html template within the module that sends the email, exemplo:

application/view/mailtemplates/teste.phhtml, (*6)

  • You can insert variables into the view template using the setData code sending email below, for example:, (*7)

    $mail = new Mail($this->getServiceLocator()->get('servicemanager')); $mail->setData(array('nome' => 'Jaime Marcelo Valasek', 'email' => 'jaime.valasek@gmail.com')), (*8)

  • html the template, (*9)

    Teste de envio de email pelo Modulo JVMail.
    
    Nome: nome?> <br>
    Email: email?>
    
  • Full PHP code to instantiate the class mail and send the mail.
use JVMail\Service\Mail;

$mail = new Mail($this->getServiceLocator()->get('servicemanager'));
$mail->setSubject('Teste de envio de email pelo modulo JVMail')
    ->setTo('recipientemail@domain.com')
    ->setData(array('nome' => 'Jaime Marcelo Valasek', 'email' => 'jaime.valasek@gmail.com'))
    ->setViewTemplate('teste')
    ->send();

The Versions

26/09 2013

dev-master

9999999-dev https://github.com/jaimevalasek/JVMail

A generic module send e-mail for ZF2.

  Sources   Download

BSD-3-Clause

The Requires

 

zf2 send email jaimevalasek