Skip to content

Commit

Permalink
yeah, it's CRLF, not LF for MIME-messages. details ;-)
Browse files Browse the repository at this point in the history
  • Loading branch information
mindplay-dk committed Sep 20, 2016
1 parent b3c5fb6 commit a63e020
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/.idea
/composer.json
/composer.lock
/vendor
/tests/_output
/tests/_support/_generated
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kodus/mail
==========

Simple services for sending e-mail.
18 changes: 18 additions & 0 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
actor: Tester
coverage:
enabled: true
include:
- src/*
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: false
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
21 changes: 21 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "kodus/mail",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"psr/log": "^1"
},
"require-dev": {
"kodus/test": "^0.3"
},
"autoload": {
"psr-4": {
"Kodus\\Mail\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Kodus\\Mail\\Test\\Unit\\": "tests/unit/"
}
}
}
23 changes: 16 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/MailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

namespace Kodus\Mail;

/**
* This simple interface permits us to abstract from how Messages are sent.
*/
interface MailService
{
/**
* @param Message $message
*
* @return void
*/
public function send(Message $message);
}
3 changes: 3 additions & 0 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Kodus\Mail;

/**
* This class represents an e-mail Message.
*/
class Message
{
/**
Expand Down
7 changes: 7 additions & 0 deletions tests/integration.suite.dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class_name: IntegrationTester
modules:
enabled:
- Asserts
- Helper\Unit:
smtp_host: localhost
smtp_port: 8090
13 changes: 8 additions & 5 deletions tests/unit/MIMEWriterCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@
use UnitTester;

/**
* NOTE: all MIME messages have been linted/validated using this online validator:
* NOTE: running this test-suite will produce files in the `_output` folder named `mail.*.txt`,
* e.g. one file for each successful test.
*
* http://www.mimevalidator.net/index.html
* All MIME messages have been linted/validated using this online validator:
*
* http://www.mimevalidator.net/index.html
*
* I'd like to eventually automate MIME validation (and preferably locally) but haven't found the tool to do it.
*/
class MIMEWriterCest
{
const TEXT_BODY = "It's me! Rasmus!\r\n\r\nI love danish characters, look: æøåÆØÅ! whoa!\r\n\r\nTake care, friend.";
const TEXT_BODY_QUOTED_PRINTABLE = "It's me! Rasmus!\r\n\r\nI love danish characters, look: =C3=A6=C3=B8=C3=A5=C3=86=C3=98=C3=85! whoa!\r\n\r\nTake care, friend.";
const TEXT_BODY_BASE64 = "SXQncyBtZSEgUmFzbXVzIQoKSSBsb3ZlIGRhbmlzaCBjaGFyYWN0ZXJzLCBsb29rOiDDpsO4w6XD\r\nhsOYw4UhIHdob2EhCgpUYWtlIGNhcmUsIGZyaWVuZC4=";
const TEXT_BODY_BASE64 = "SXQncyBtZSEgUmFzbXVzIQ0KDQpJIGxvdmUgZGFuaXNoIGNoYXJhY3RlcnMsIGxvb2s6IMOmw7jD\r\npcOGw5jDhSEgd2hvYSENCg0KVGFrZSBjYXJlLCBmcmllbmQu";

const HTML_BODY = "<strong>It's me! Rasmus!</strong>\n\nI love danish characters, look: æøåÆØÅ! whoa!\n\nTake care, friend.";
const HTML_BODY_QUOTED_PRINTABLE = "<strong>It's me! Rasmus!</strong>\n\nI love danish characters, look: =C3=A6=C3=B8=C3=A5=C3=86=C3=98=C3=85! whoa!\n\nTake care, friend.";
const HTML_BODY = "<strong>It's me! Rasmus!</strong>\n\nI love danish characters, look: æøåÆØÅ! whoa!\r\n\r\nTake care, friend.";
const HTML_BODY_QUOTED_PRINTABLE = "<strong>It's me! Rasmus!</strong>=0A=0AI love danish characters, look: =C3=\r\n=A6=C3=B8=C3=A5=C3=86=C3=98=C3=85! whoa!\r\n\r\nTake care, friend.";

private $last_mime;

Expand Down

0 comments on commit a63e020

Please sign in to comment.