pony 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +32 -7
- data/lib/pony.rb +2 -1
- data/pony.gemspec +1 -1
- data/spec/pony_spec.rb +13 -0
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
Ruby no longer has to be jealous of PHP's mail() function, which can send an email in a single command.
|
6
6
|
|
7
7
|
Pony.mail(:to => 'you@example.com', :from => 'me@example.com', :subject => 'hi', :body => 'Hello there.')
|
8
|
-
Pony.mail(:to => 'you@example.com', :
|
8
|
+
Pony.mail(:to => 'you@example.com', :body => '<h1>Hello there!</h1>', :content_type => 'text/html')
|
9
9
|
Pony.mail(:to => 'you@example.com', :cc => 'him@example.com', :from => 'me@example.com', :subject => 'hi', :body => 'Howdy')
|
10
10
|
|
11
|
-
Any option key may be omitted except for :to.
|
11
|
+
Any option key may be omitted except for :to. For a complete list of options, see List Of Options section below.
|
12
12
|
|
13
13
|
|
14
14
|
== Transport
|
@@ -28,7 +28,7 @@ You can also specify options for SMTP:
|
|
28
28
|
:port => '25',
|
29
29
|
:user => 'user',
|
30
30
|
:password => 'password',
|
31
|
-
:auth => :plain # :plain, :login, :cram_md5, no auth by default
|
31
|
+
:auth => :plain, # :plain, :login, :cram_md5, no auth by default
|
32
32
|
:domain => "localhost.localdomain" # the HELO domain provided by the client to the server
|
33
33
|
}
|
34
34
|
|
@@ -42,7 +42,7 @@ With smtp transport it also possible to use TLS/SSL:
|
|
42
42
|
:tls => true,
|
43
43
|
:user => 'user',
|
44
44
|
:password => 'password',
|
45
|
-
:auth => :plain # :plain, :login, :cram_md5, no auth by default
|
45
|
+
:auth => :plain, # :plain, :login, :cram_md5, no auth by default
|
46
46
|
:domain => "localhost.localdomain" # the HELO domain provided by the client to the server
|
47
47
|
})
|
48
48
|
|
@@ -52,7 +52,24 @@ You can attach a file or two with the :attachments option:
|
|
52
52
|
|
53
53
|
Pony.mail(..., :attachments => {"foo.zip" => File.read("path/to/foo.zip"), "hello.txt" => "hello!"})
|
54
54
|
|
55
|
-
An attachment's mime-type is set based on the filename (as dictated by the ruby gem mime-types). So 'foo.pdf' has a mime-type of 'application/pdf'
|
55
|
+
Note: An attachment's mime-type is set based on the filename (as dictated by the ruby gem mime-types). So 'foo.pdf' has a mime-type of 'application/pdf'
|
56
|
+
|
57
|
+
== List Of Options
|
58
|
+
|
59
|
+
Options passed pretty much directly to Tmail
|
60
|
+
content_type
|
61
|
+
to
|
62
|
+
cc
|
63
|
+
bcc
|
64
|
+
from
|
65
|
+
subject
|
66
|
+
charset
|
67
|
+
attachments # see Attachments section above
|
68
|
+
|
69
|
+
Other options
|
70
|
+
via # :smtp or :sendmail, see Transport section above
|
71
|
+
smtp # specify smtp info, see Transport section above
|
72
|
+
tls # use tls, see TLS/SSL section above
|
56
73
|
|
57
74
|
== Meta
|
58
75
|
|
@@ -61,14 +78,22 @@ Maintained by Ben Prew
|
|
61
78
|
Written by Adam Wiggins
|
62
79
|
|
63
80
|
Patches contributed by: Mathieu Martin, Arun Thampi, Thomas Hurst, Stephen
|
64
|
-
Celis, Othmane Benkirane, Neil Mock, Hiroshi Saito, and Nickolas Means
|
81
|
+
Celis, Othmane Benkirane, Neil Mock, Hiroshi Saito, Jesse Cooke, and Nickolas Means
|
65
82
|
|
66
83
|
Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
|
67
84
|
|
68
|
-
http://github.com/benprew/pony
|
85
|
+
homepage: http://github.com/benprew/pony
|
86
|
+
mailing list: ponyrb@googlegroups.com
|
87
|
+
|
69
88
|
|
70
89
|
== Releases
|
71
90
|
|
91
|
+
0.6
|
92
|
+
* Add :bcc capability
|
93
|
+
* Add :charset capability
|
94
|
+
* Add complete list of options to readme
|
95
|
+
* fix bug: readme examples
|
96
|
+
|
72
97
|
0.5
|
73
98
|
* default location of sendmail to /usr/sbin/sendmail if sendmail not in path
|
74
99
|
* fix bug: README not showing password option (listed as pass)
|
data/lib/pony.rb
CHANGED
@@ -30,9 +30,9 @@ module Pony
|
|
30
30
|
|
31
31
|
def self.build_tmail(options)
|
32
32
|
mail = TMail::Mail.new
|
33
|
-
mail.content_type = options[:content_type] if options[:content_type]
|
34
33
|
mail.to = options[:to]
|
35
34
|
mail.cc = options[:cc] || ''
|
35
|
+
mail.bcc = options[:bcc] || ''
|
36
36
|
mail.from = options[:from] || 'pony@unknown'
|
37
37
|
mail.subject = options[:subject]
|
38
38
|
if options[:attachments]
|
@@ -55,6 +55,7 @@ module Pony
|
|
55
55
|
mail.content_type = options[:content_type] || "text/plain"
|
56
56
|
mail.body = options[:body] || ""
|
57
57
|
end
|
58
|
+
mail.charset = options[:charset] # charset must be set after setting content_type
|
58
59
|
mail
|
59
60
|
end
|
60
61
|
|
data/pony.gemspec
CHANGED
data/spec/pony_spec.rb
CHANGED
@@ -36,6 +36,19 @@ describe Pony do
|
|
36
36
|
Pony.build_tmail(:from => 'joe@example.com').from.should == [ 'joe@example.com' ]
|
37
37
|
end
|
38
38
|
|
39
|
+
it "bcc" do
|
40
|
+
Pony.build_tmail(:bcc => 'joe@example.com').bcc.should == [ 'joe@example.com' ]
|
41
|
+
end
|
42
|
+
|
43
|
+
it "charset" do
|
44
|
+
Pony.build_tmail(:charset => 'UTF-8').charset.should == 'UTF-8'
|
45
|
+
end
|
46
|
+
|
47
|
+
it "default charset" do
|
48
|
+
Pony.build_tmail(:body => 'body').charset.should == nil
|
49
|
+
Pony.build_tmail(:body => 'body', :content_type => 'text/html').charset.should == nil
|
50
|
+
end
|
51
|
+
|
39
52
|
it "from (default)" do
|
40
53
|
Pony.build_tmail({}).from.should == [ 'pony@unknown' ]
|
41
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.6"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Wiggins
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2010-01-03 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|