Skip to content

Commit

Permalink
Squashed 'subtree/txtthinking/Mailer/' changes from 07d7cb0..af82e9a
Browse files Browse the repository at this point in the history
af82e9a Update README.md
7d9a245 Merge pull request splitbrain#32 from lainme/master
b1bf14d Allow insecure ssl connection
e09f9a1 Merge pull request splitbrain#25 from Borian23/master
2a63e44 Set reply-to
ecee529 Merge pull request splitbrain#24 from txthinking/updates
55ccc4d explicitly set protocols on 'tls' connection
c0f0480 slightly updated phpunit, adjusted travis
49cd4e5 Merge pull request splitbrain#22 from Xylane/patch-1
2de137b Update Message.php
073c654 remove php5.6 test, next version will unsupport
09013cf support tlsv1.0 tlsv1.1 tlsv1.2
cf3af43 Merge pull request splitbrain#19 from joshtronic/feat_expand-tls
c375f9f feat(tls): expand tls options
648ca5a remove setTo,setAttachment fixed splitbrain#15
06a378f Merge pull request splitbrain#14 from Echosong/master
e95c7ab cli
3bbf157 update test from email
d243432 Merge branch 'vinkla-patch-2'
27001aa Merge branch 'patch-2' of git://github.com/vinkla/Mailer into vinkla-patch-2
c384252 Merge pull request splitbrain#12 from vinkla/patch-1
ba62b03 Ignore phpunit.xml locally
72aef58 Rename phpunit.xml to phpunit.xml.dist
f6ae003 Remove blankline
7cabdf3 Add .gitattributes
a5d9ebb support SASL AUTH OAUTHBEARER Mechanism. splitbrain#11
6d3e91a for non-ascii reply-to
364c937 Merge pull request splitbrain#10 from daemionfox/master
e7783dd Added reply-to
da10c0b readme
b0124f9 allow add cc and bcc
4dcaeda base64 encode subject
a5478de utf-8 base64 encode name
f372aa2 allow to send more persons who has same name, and love psr2
4746e50 add ci status
25d95e1 facebook/hhvm#1647
4943e69 fxied undefine variable
0708abd fixed for 5.3 syntax error in testing file and hhvm namespace function error
8b7bd57 add more sleeping
33b095a auto test
8c92f5a Merge pull request splitbrain#7 from splitbrain/mailtrap
574b664 Merge pull request splitbrain#8 from splitbrain/minorcleanup
9d029a0 do not send /etc/hosts in test mails
e8ff6d1 removed outdated param docs
a15e2d2 added missing PHPdocs
2253bdf send returns bool
3914f8a added travis config for automated tests
6acc17d run a SMTP test via TLS
1c2faeb run the exception test against localhost again
70e1674 adhere to limits
7d912a6 use mailtrap.io for testing
98cfc1f Merge pull request splitbrain#6 from splitbrain/tls
21624b3 fix TLS command
248353c Merge branch 'master' of github.com:txthinking/Mailer into ehlo
97331ad Merge branch 'splitbrain-master' into develop
543f35d update composer
85662a3 allow to set custom EHLO message

git-subtree-dir: subtree/txtthinking/Mailer
git-subtree-split: af82e9a
  • Loading branch information
lainme committed May 26, 2023
1 parent 07d7cb0 commit b307765
Show file tree
Hide file tree
Showing 14 changed files with 562 additions and 1,313 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* text=auto

/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/README.md export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ vendor/
composer.lock
.idea/
docs/
phpunit.xml
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: php
sudo: false
php:
- "7.4"
- "7.3"
- "7.2"
- "7.1"
- "7.0"
- "5.6"
install: composer update
script: ./vendor/bin/phpunit --verbose
38 changes: 10 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ A lightweight SMTP mail sender

```
$ composer require txthinking/mailer
# or
$ composer require txthinking/mailer:dev-master
```

### Usage
Expand All @@ -16,36 +18,16 @@ $ composer require txthinking/mailer
use Tx\Mailer;
$ok = (new Mailer())
->setServer('smtp.ym.163.com', 25)
->setAuth('', '') // email, password
->setFrom('You', '') //your name, your email
->setFakeFrom('heelo', 'bot@fake.com') // if u want, a fake name, a fake email
->addTo('Cloud', 'cloud@txthinking.com')
->setSubject('Test Mailer')
->setBody('Hi, I <strong>love</strong> you.')
->setServer('smtp.server.com', 25)
->setAuth('[email protected]', 'password')
->setFrom('Tom', '[email protected]')
->setFakeFrom('Obama', 'fake@address.com') // if u want, a fake name, a fake email
->addTo('Jerry', 'jerry@server.com')
->setSubject('Hello')
->setBody('Hi, Jerry! I <strong>love</strong> you.')
->addAttachment('host', '/etc/hosts')
->send();
var_dump($ok);
```
OR
```
<?php
use \Tx\Mailer\SMTP;
use \Tx\Mailer\Message;
use \Monolog\Logger;
$smtp = new SMTP(); // new SMTP(new Logger('Mailer')); # set logger to receive debug log
$smtp->setServer('smtp.ym.163.com', 25)
->setAuth('[email protected]', ''); // email, password
More [Example](https://github.com/txthinking/Mailer/tree/master/tests)

$message = new Message();
$message->setFrom('Tom', '[email protected]') // your name, your email
->setFakeFrom('heelo', '[email protected]') // if u want, a fake name, a fake email
->addTo('Cloud', '[email protected]')
->setSubject('Test Mailer')
->setBody('<h1>For test</h1>')
->addAttachment('host', '/etc/hosts');
$ok = $smtp->send($message);
var_dump($ok);
```
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
],
"require": {
"php": ">=5.3.2",
"monolog/monolog": "~1.13"
"psr/log": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"erb/testing-tools": "dev-master"
"phpunit/phpunit": "~5.0",
"monolog/monolog": "~1.13"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit b307765

Please sign in to comment.