Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxfreck/pechkin
Pechkin is a small and easy-to-use mailing library for PHP
https://github.com/maxfreck/pechkin
curl email php php-library proxy smtp-client
Last synced: about 1 month ago
JSON representation
Pechkin is a small and easy-to-use mailing library for PHP
- Host: GitHub
- URL: https://github.com/maxfreck/pechkin
- Owner: maxfreck
- License: mit
- Created: 2018-02-03T13:28:06.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-20T19:22:01.000Z (over 4 years ago)
- Last Synced: 2024-11-18T09:49:27.376Z (about 2 months ago)
- Topics: curl, email, php, php-library, proxy, smtp-client
- Language: PHP
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pechkin — a small and easy-to-use mailing library for PHP
## Features
- Support for PSR-7 streams.
- Send emails with multiple To, Cc, Bcc and Reply-to addresses.
- Send emails through http/socks proxy.
- Support for raw, multipart/alternative, multipart/mixed and multipart/related emails.## Installing Pechkin
The recommended way to install Pechkin is through [Composer](http://getcomposer.org).
Install Composer:
```bash
curl -sS https://getcomposer.org/installer | php
```Next, run the Composer command to install the latest stable version of Pechkin:
```bash
php composer.phar require maxfreck/pechkin
```After installing, you need to require Composer's autoloader:
```php
require 'vendor/autoload.php';
```You can then later update Pechkin using composer:
```bash
composer.phar update
```## Using Pechkin
All email metainformation (content type, file name, attachment disposition) is passed as a stream metadata.
Basic usage example:
```php
Lorem ipsumLorem 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.
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();
```## To-Do
- Raw SMTP sender similar to PHPMailer.