1. Go to this page and download the library: Download maxfreck/pechkin 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/ */
maxfreck / pechkin example snippets
//use composer's autoloader
hkin\Streams\FileStream;
use \Pechkin\fn;
fn::$host = 'example.org';
$body = <<<EOD
<h1>Lorem ipsum</h1>
<div><img src="cid:img1"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.</p>
EOD;
$mailer = new CurlMailer(
"smtps://smtp.example.org:465",
"[email protected]",
"Nemo's password",
(object)[
'from' => (object)['email' => '[email protected]', 'name' => 'Nemo Nobody'],
'replyTo' => [
(object)['email' => '[email protected]', 'name' => 'Nemo Nobody'],
],
'to' => [
(object)['email' => '[email protected]', 'name' => 'Mr. Foo'],
],
'subject' => "Hello, Mr. Foo",
'body' => FileStream::fromString($body, ['content-type' => 'text/html; charset="utf-8"']),
'altBody' => FileStream::fromString("This is alt body"),
//'proxy' => 'socks5://127.0.0.1:8080' //See CURLOPT_PROXY for more information
]
);
$mailer->addAttachment(
new FileStream(
'image.png',
'r',
[
'content-type' => fn::fileMime('image.png'),
'name' => 'image.png',
'disposition' => 'inline'
]
),
'img1' //Attachment content ID
);
$mailer->send();