PHP code example of thedavidinyang / phpsimplemail

1. Go to this page and download the library: Download thedavidinyang/phpsimplemail library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thedavidinyang / phpsimplemail example snippets



$e = new Mailer;

$setup = ['host' => '', 'username'=>'', 'password'=>'', 'authentication'=>'', 'port'=>''  ];

$e->init('smtp')
->setup($setup)
->subject('Welcome')
->to(['name' => 'David Inyang', 'email'=>'[email protected]'])
->from(['name' => 'David Inyang', 'email'=>'[email protected]'])
->body('Hi, welcome to the team')
->sendmail();

// somewhere early in your project's loading, d

// reference the SimpleMail namespace
use thedavidinyang\SimpleMail\Mailer;

// Setup SMTP Configurations
$setup = ['host' => '', 'username'=>'', 'password'=>'', 'authentication'=>'', 'port'=>''  ];

// initialize and use the SimpleMail class
$e = new Mailer;

$e->init('smtp')
->setup($setup)

// Set mail parameters

// Subject
->subject('Welcome')

// Recipient
->to(['name' => 'David Inyang', 'email'=>'[email protected]'])

// Sender
->from(['name' => 'David Inyang', 'email'=>'[email protected]'])

// Content
->body('Hi, welcome to the team')



// Send mail
->sendmail();


// reference the SimpleMail namespace
use thedavidinyang\SimpleMail\Mailer;

// Setup SMTP Configurations
$setup = ['apiKey' => '' ];

// initialize and use the SimpleMail class
$e = new Mailer;

$e->init('sendgrid')
->setup($setup)

// Set mail parameters

// Subject
->subject('Welcome')

// Recipient
->to(['name' => 'David Inyang', 'email'=>'[email protected]'])

// Sender
->from(['name' => 'David Inyang', 'email'=>'[email protected]'])

// Content
->body('Hi, welcome to the team')



// Send mail
->sendmail();