malone 1.0.0.rc1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +57 -46
- data/malone.gemspec +1 -1
- metadata +8 -8
data/README.md
CHANGED
@@ -1,71 +1,82 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
[blogpost]: http://www.pipetodevnull.com/past/2010/11/27/simple_mailer/
|
1
|
+
malone(1) -- send mail using smtp without any fuss
|
2
|
+
==================================================
|
4
3
|
|
5
4
|
## USAGE
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
require "malone"
|
7
|
+
|
8
|
+
# Typically you would do this somewhere in the bootstrapping
|
9
|
+
# part of your application
|
9
10
|
|
10
|
-
|
11
|
+
m = Malone.connect(url: "smtp://foo%40bar.com:pass@smtp.gmail.com:587",
|
12
|
+
domain: "mysite.com")
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
m.deliver(from: "me@me.com", to: "you@me.com",
|
15
|
+
subject: "Test subject", text: "Great!")
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
# Malone.current will now remember the last configuration you setup.
|
18
|
+
Malone.current.config == m.config
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
# Now you can also do Malone.deliver, which is syntactic sugar
|
21
|
+
# for Malone.current.deliver
|
22
|
+
Malone.deliver(from: "me@me.com", to: "you@me.com",
|
23
|
+
subject: "Test subject", text: "Great!")
|
20
24
|
|
21
|
-
#
|
22
|
-
|
25
|
+
# Also starting with Malone 1.0, you can pass in :html
|
26
|
+
# for multipart emails.
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
subject: "Test subject", text: "Great!")
|
28
|
+
Malone.deliver(from: "me@me.com", to: "you@me.com",
|
29
|
+
subject: "Test subject",
|
30
|
+
text: "Great!", html: "<b>Great!</b>")
|
28
31
|
|
29
|
-
# Also starting with Malone 1.0, you can also pass in :html
|
30
|
-
# for multipart emails.
|
31
32
|
|
32
|
-
|
33
|
-
subject: "Test subject",
|
34
|
-
text: "Great!", html: "<b>Great!</b>")
|
33
|
+
## TESTING
|
35
34
|
|
36
|
-
|
35
|
+
require "malone/test"
|
37
36
|
|
38
|
-
|
37
|
+
m = Malone.connect(url: "smtp://foo%40bar.com:pass@smtp.gmail.com:587",
|
38
|
+
domain: "mysite.com")
|
39
39
|
|
40
|
-
|
40
|
+
m.deliver(from: "me@me.com", to: "you@me.com",
|
41
|
+
subject: "Test subject", text: "Great!")
|
42
|
+
|
43
|
+
Malone.deliveries.size == 1
|
44
|
+
# => true
|
45
|
+
|
46
|
+
mail = Malone.deliveries.first
|
47
|
+
|
48
|
+
"me@me.com" == mail.from
|
49
|
+
# => true
|
50
|
+
|
51
|
+
"you@me.com" == mail.to
|
52
|
+
# => true
|
41
53
|
|
42
|
-
|
43
|
-
|
54
|
+
"FooBar" == mail.text
|
55
|
+
# => true
|
44
56
|
|
45
|
-
|
46
|
-
|
57
|
+
"Hello World" == envelope.subject
|
58
|
+
# => true
|
47
59
|
|
48
|
-
|
49
|
-
subject: "Test subject", text: "Great!")
|
60
|
+
## INSTALLATION
|
50
61
|
|
51
|
-
|
52
|
-
# => true
|
62
|
+
gem install malone
|
53
63
|
|
54
|
-
|
64
|
+
## CONFIGURATION TIPS
|
55
65
|
|
56
|
-
|
57
|
-
|
66
|
+
If you're used to doing configuration via environment
|
67
|
+
variables, similar to how Heroku does configuration, then
|
68
|
+
you can simply set an environment variable in your
|
69
|
+
production machine like so:
|
58
70
|
|
59
|
-
|
60
|
-
# => true
|
71
|
+
export MALONE_URL=smtp://foo%40bar.com:pass@smtp.gmail.com:587
|
61
72
|
|
62
|
-
|
63
|
-
|
73
|
+
Then you can connect using the environment variable in your
|
74
|
+
code like so:
|
64
75
|
|
65
|
-
|
66
|
-
# => true
|
67
|
-
```
|
76
|
+
Malone.connect(url: ENV["MALONE_URL"])
|
68
77
|
|
69
|
-
|
78
|
+
# or quite simply
|
79
|
+
Malone.connect
|
70
80
|
|
71
|
-
|
81
|
+
By default Malone tries for the environment variable `MALONE_URL` when
|
82
|
+
you call `Malone.connect` without any arguments.
|
data/malone.gemspec
CHANGED
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: malone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Cyril David
|
@@ -13,7 +13,7 @@ date: 2011-01-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mailfactory
|
16
|
-
requirement: &
|
16
|
+
requirement: &70338423965500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.4'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70338423965500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: cutest
|
27
|
-
requirement: &
|
27
|
+
requirement: &70338423965000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70338423965000
|
36
36
|
description:
|
37
37
|
email: me@cyrildavid.com
|
38
38
|
executables: []
|
@@ -62,9 +62,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
|
-
- - ! '
|
65
|
+
- - ! '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: '0'
|
68
68
|
requirements: []
|
69
69
|
rubyforge_project:
|
70
70
|
rubygems_version: 1.8.11
|