2017 © Pedro Peláez
 

library email

Abstract class for email sending in WordPress

image

truongwp/email

Abstract class for email sending in WordPress

  • Thursday, August 31, 2017
  • by truongwp
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

An abstract class for email sending in WordPress., (*1)

Installation

Use composer to include the library:, (*2)

composer require truongwp/email="*", (*3)

Usage

/**
 * Class ExampleEmail
 */
class ExampleEmail extends Truongwp\Email {

    /**
     * Whether to use HTML in email.
     *
     * @var bool
     */
    protected $html = true;

    /**
     * Gets email subject.
     *
     * @return string
     */
    protected function subject() {
        return 'Example email subject';
    }

    /**
     * Gets email content body.
     *
     * @return string
     */
    protected function content_body() {
        return '<p>Hi %%customer_name%%.<br>This is an example email from <span class="red">%%site_name%%</span></p>';
    }

    /**
     * Gets email content footer.
     *
     * @return string
     */
    protected function content_footer() {
        if ( $this->html ) {
            return '<p>Best Regards,<br>Truongwp</p>';
        }

        return "Best Regards,\nTruongwp";
    }

    /**
     * Gets css for email content.
     *
     * @return string
     */
    protected function content_css() {
        return '.red { color: red; }';
    }
}

$email = new ExampleEmail();
$email->replace( '%%customer_name%%', 'Truong' );
$email->send( 'truongwp@gmail.com' );

The Versions

31/08 2017

dev-master

9999999-dev

Abstract class for email sending in WordPress

  Sources   Download

GPLv2 or later

The Requires

 

31/08 2017

1.1.0

1.1.0.0

Abstract class for email sending in WordPress

  Sources   Download

GPLv2 or later

The Requires

 

25/08 2017

1.0.0

1.0.0.0

Abstract class for email sending in WordPress

  Sources   Download

GPLv2 or later

The Requires

 

25/08 2017

0.1.1

0.1.1.0

Abstract class for email sending in WordPress

  Sources   Download

GPLv2 or later

The Requires