PHP code example of gabriel-binotti / email

1. Go to this page and download the library: Download gabriel-binotti/email 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/ */

    

gabriel-binotti / email example snippets


composer 

host = nameserve
username = user
password = password
auth = 'true' or 'false'
port = 587 or 465
charset = 'UTF-8'
secure = 'false' or 'true'

use GabrielBinottiEmail\Email;

')                       // name file .ini
        ->debug()                               // active show debug (server, client or off "default is off")
        ->from("email", "name")                 // sender's email , name (Can your name or you company...)
        ->reply("email", "name ")               // answer email (optional)
        ->destination("email", 'name')          // recipient email , name
        ->subject("subject email")              // subject email
        ->bodyHtml('text body')                 // text body
        ->options([
            "ssl" => [
                'verify_peer'       => false,   
                'verify_peer_name'  => false,   
                'allow_self_signed' => true    
            ]
        ])
        ->send();                               // send email
        
} catch (Exception $e) {
    echo $e->getMessage();
}
        
    template('template.html');                    

$arrayReplace = [
    [
        "before" => "value",
        "after" => "value",
    ],
    [
        "before" => "value",
        "after" => "value",
    ]
];

 template('template.html', $arrayReplace);

addFile("filename.format", "name file");

addImage("image.format", "name image");

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img src="cid:nameImage" alt="">
</body>
</html>