2017 © Pedro Peláez
 

library mail

Extension kit for NF Theme

image

vicoders/mail

Extension kit for NF Theme

  • Monday, June 25, 2018
  • by Garung
  • Repository
  • 0 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 225 % Grown

The README.md

Send Email Kit

It's an extension kit for our theme https://github.com/hieu-pv/nf-theme, (*1)

, (*2)

Installation

composer require vicoders/mail

Configuration

1. Open config/app.php file and insert a below line:
"providers"  => [
    ... (Other Provider)
    \Vicoders\Mail\EmailServiceProvider::class
],
2. Insert and Update wp-config.php file:
define('SENDMAIL_DRIVER', 'wp_mail'); // api, wp_mail, mailchimp (updating). Default is wp_mail
  • If SENDMAIL_DRIVER is api, insert 2 constants to wp-config.php:
define('EMAIL_USERNAME', '<username>');
define('EMAIL_PASSWORD', '<password>');

Choose type channel

Login with admin account, click "Theme Configuration" and choose "For Send Email" tab - Has 3 type: + Api + wp_mail + mailchimp (updating ...), (*3)

, (*4)

Crazy Way: Send email with one or more
  • Create Input data include more user
  • Create Input param
  • Get content html template file
  • Use data to match with variables into html template
  • Set info for an array Receivers
  • And use send email function

Example:, (*5)

    $user_data = [
        [
            'email' => 'cus_email@gmail.com',
            'name'  => 'Name 1'
        ],
        [
            'email' => 'cus_email@gmail.com',
            'name'  => 'Name 2'
        ]
    ];

    $config = [
        'apiuri'          => '<send email api url>'
    ];
    $params = [
        'variables_1' => 'value_1',
        'variables_2' => 'value_2',
    ];
    $subject = 'No subject';
    $app_id  = 1; 
    $user_id = 1; 

    $email_template = file_get_contents(PATH_FILE_HTML_TEMPLATE);

    $users = collect($user_data);
    $users = $users->map(function($item) use ($params, $subject, $app_id, $user_id){
        $tmp_user = new \Vicoders\Mail\Models\User();
        $tmp_user->setName($item['name'])
                 ->setTo($item['email'])
                 ->setAppId($app_id)
                 ->setUserId($user_id)
                 ->setSubject($subject)
                 ->setParams($params);
        return $tmp_user;
    });

    $email = new \Vicoders\Mail\Email($config);
    $email->send($users, $email_template);

Note - Options for Config:, (*6)

Expand Options:
- mail_host
- mail_port, 
- mail_from, 
- mail_name, 
- mail_username, 
- mail_password, 
- mail_encryption
Last Mission:
  • Check receiver email

The Versions

25/06 2018

dev-master

9999999-dev

Extension kit for NF Theme

  Sources   Download

MIT

The Requires

 

by Avatar Garung

25/06 2018

dev-dev_garung

dev-dev_garung

Extension kit for NF Theme

  Sources   Download

MIT

The Requires

 

by Avatar Garung

25/06 2018

v1.0.3

1.0.3.0

Extension kit for NF Theme

  Sources   Download

MIT

The Requires

 

by Avatar Garung

30/05 2018

v1.0.2

1.0.2.0

Extension kit for NF Theme

  Sources   Download

MIT

The Requires

 

by Avatar Garung

29/05 2018

v1.0.1

1.0.1.0

Extension kit for NF Theme

  Sources   Download

MIT

The Requires

 

by Avatar Garung