Skip to content

Commit 9e8cf0a

Browse files
committed
version 2.0.0
1 parent 7408655 commit 9e8cf0a

File tree

3 files changed

+255
-120
lines changed

3 files changed

+255
-120
lines changed

README.md

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,57 @@
11
# Mailer
22
PHP Class for sending email.
33

4-
## For example
4+
# Install
5+
## With [Composer](https://getcomposer.org/)
6+
1. Run in console:
7+
```text
8+
php composer.phar require ddrv/mailer
9+
php composer.phar install
10+
```
11+
1. Include autoload file
12+
```php
13+
include('vendor/autoload.php');
14+
```
15+
## Manually install
16+
1. Download [Archive](https://github.com/ddrv/mailer/archive/master.zip)
17+
1. Unzip archive to /path/to/libraries/
18+
1. Include files
19+
```php
20+
require_once('/path/to/libraries/mailer/src/Mailer.php');
21+
```
22+
23+
#Usage
524
625
```php
26+
/**
27+
* Inititalization Mailer class.
28+
* Sender must be [email protected]
29+
* Encoding of mail must be UTF-8
30+
*/
31+
$mailer = new \Ddrv\Mailer\Mailer('[email protected]','utf8');
32+
33+
/**
34+
* Set subject of mail
35+
*/
36+
$mailer->subject('Subject of mail');
37+
38+
/**
39+
* Add text of mail in HTML format
40+
*/
41+
$mailer->body('<p>Simple text</p>');
42+
43+
/**
44+
* In need adding attachment from string, run
45+
*/
46+
$mailer->attachFromString('content','attach1.txt');
47+
48+
/**
49+
* In need adding attachment from file, run
50+
*/
51+
$mailer->attachFromFile('/path/to/file','attach2.txt');
752
8-
$params = [
9-
'sender' => '[email protected]',
10-
'charset' => 'utf8',
11-
];
12-
13-
$mailer = new \Ddrv\Mailer\Mailer($params);
14-
15-
// Simple text
16-
$mailer->send('[email protected]','Test Simple Text', 'This is simple text');
17-
18-
// Attachments
19-
$attachments = array(
20-
// Attachment from string
21-
array(
22-
'name' => 'attach_from_string.txt',
23-
'type' => 'string',
24-
'content' => 'Content of attach 1',
25-
),
26-
// Attachment from file
27-
array(
28-
'name' => 'attach_from_file.txt',
29-
'type' => 'file',
30-
'content' => '/path/to/file',
31-
)
32-
);
33-
$mailer->send('[email protected]','Test Attachments', '<i>This is Body</i>', $attachments);
34-
```
53+
/**
54+
* Send email to [email protected]
55+
*/
56+
$mailer->send('[email protected]');
57+
```

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "ddrv/mailer",
3-
"version":"1.0.0",
3+
"version":"2.0.0",
44
"require":{
5-
"php":">=5.3.0"
5+
"php":">=5.4.0"
66
},
77
"type": "library",
88
"description": "PHP Class for sending email",

0 commit comments

Comments
 (0)