pony 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +9 -5
- data/lib/foo +97 -0
- data/lib/pony.rb +35 -34
- data/pony.gemspec +1 -1
- metadata +23 -5
data/README.rdoc
CHANGED
@@ -18,7 +18,7 @@ Pony uses /usr/sbin/sendmail to send mail if it is available, otherwise it uses
|
|
18
18
|
This can be over-ridden if you specify a via option:
|
19
19
|
|
20
20
|
Pony.mail(:to => 'you@example.com', :via => :smtp) # sends via SMTP
|
21
|
-
|
21
|
+
|
22
22
|
Pony.mail(:to => 'you@example.com', :via => :sendmail) # sends via sendmail
|
23
23
|
|
24
24
|
You can also specify options for SMTP:
|
@@ -63,7 +63,7 @@ Note: An attachment's mime-type is set based on the filename (as dictated by the
|
|
63
63
|
|
64
64
|
Pony allows you to specify custom mail headers
|
65
65
|
Pony.mail(
|
66
|
-
:to => 'me@example.com',
|
66
|
+
:to => 'me@example.com',
|
67
67
|
:headers => { "List-ID" => "...", "X-My-Custom-Header" => "what a cool custom header" }
|
68
68
|
)
|
69
69
|
|
@@ -82,18 +82,19 @@ Options passed pretty much directly to Mail
|
|
82
82
|
attachments # see Attachments section above
|
83
83
|
headers # see Custom headers section above
|
84
84
|
message_id
|
85
|
-
sender
|
85
|
+
sender # Sets "envelope from" (and the Sender header)
|
86
|
+
reply_to
|
86
87
|
|
87
88
|
Other options
|
88
89
|
via # :smtp or :sendmail, see Transport section above
|
89
90
|
via_options # specify transport options, see Transport section above
|
90
91
|
|
91
|
-
== Set default options
|
92
|
+
== Set default options
|
92
93
|
|
93
94
|
Default options can be set so that they don't have to be repeated. The default options you set will be overriden by any options you pass in to Pony.mail()
|
94
95
|
|
95
96
|
Pony.options = { :from => 'noreply@example.com', :via => :smtp, :via_options => { :host => 'smtp.yourserver.com' } }
|
96
|
-
Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp
|
97
|
+
Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp
|
97
98
|
Pony.mail(:from => 'pony@example.com', :to => 'foo@bar') # Sends mail to foo@bar from pony@example.com using smtp
|
98
99
|
|
99
100
|
== Help
|
@@ -134,6 +135,9 @@ mailing list: ponyrb@googlegroups.com
|
|
134
135
|
|
135
136
|
== Releases
|
136
137
|
|
138
|
+
1.4
|
139
|
+
* Updated docs
|
140
|
+
|
137
141
|
1.3
|
138
142
|
* Add new option :text_part_charset, which allows you to specify the charset for the text portion
|
139
143
|
|
data/lib/foo
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
= The express way to send email in Ruby
|
2
|
+
|
3
|
+
== Overview
|
4
|
+
|
5
|
+
Ruby no longer has to be jealous of PHP's mail() function, which can send an email in a single command.
|
6
|
+
|
7
|
+
Pony.mail(:to => 'you@example.com', :from => 'me@example.com', :subject => 'hi', :body => 'Hello there.')
|
8
|
+
Pony.mail(:to => 'you@example.com', :html_body => '<h1>Hello there!</h1>', :body => "In case you can't read html, Hello there.")
|
9
|
+
Pony.mail(:to => 'you@example.com', :cc => 'him@example.com', :from => 'me@example.com', :subject => 'hi', :body => 'Howsit!')
|
10
|
+
|
11
|
+
Any option key may be omitted except for :to. For a complete list of options, see List Of Options section below.
|
12
|
+
|
13
|
+
|
14
|
+
== Transport
|
15
|
+
|
16
|
+
Pony uses /usr/sbin/sendmail to send mail if it is available, otherwise it uses SMTP to localhost.
|
17
|
+
|
18
|
+
This can be over-ridden if you specify a via option:
|
19
|
+
|
20
|
+
Pony.mail(:to => 'you@example.com', :via => :smtp) # sends via SMTP
|
21
|
+
|
22
|
+
Pony.mail(:to => 'you@example.com', :via => :sendmail) # sends via sendmail
|
23
|
+
|
24
|
+
You can also specify options for SMTP:
|
25
|
+
|
26
|
+
Pony.mail(:to => 'you@example.com', :via => :smtp, :via_options => {
|
27
|
+
:address => 'smtp.yourserver.com',
|
28
|
+
:port => '25',
|
29
|
+
:user_name => 'user',
|
30
|
+
:password => 'password',
|
31
|
+
:authentication => :plain, # :plain, :login, :cram_md5, no auth by default
|
32
|
+
:domain => "localhost.localdomain" # the HELO domain provided by the client to the server
|
33
|
+
}
|
34
|
+
|
35
|
+
Gmail example (with TLS/SSL)
|
36
|
+
|
37
|
+
Pony.mail(:to => 'you@example.com', :via => :smtp, :via_options => {
|
38
|
+
:address => 'smtp.gmail.com',
|
39
|
+
:port => '587',
|
40
|
+
:enable_starttls_auto => true,
|
41
|
+
:user_name => 'user',
|
42
|
+
:password => 'password',
|
43
|
+
:authentication => :plain, # :plain, :login, :cram_md5, no auth by default
|
44
|
+
:domain => "localhost.localdomain" # the HELO domain provided by the client to the server
|
45
|
+
})
|
46
|
+
|
47
|
+
And options for Sendmail:
|
48
|
+
|
49
|
+
Pony.mail(:to => 'you@example.com', :via => :smtp, :via_options => {
|
50
|
+
:location => '/path/to/sendmail' # this defaults to 'which sendmail' or '/usr/sbin/sendmail' if 'which' fails
|
51
|
+
:arguments => '-t' # -t and -i are the defaults
|
52
|
+
}
|
53
|
+
|
54
|
+
== Attachments
|
55
|
+
|
56
|
+
You can attach a file or two with the :attachments option:
|
57
|
+
|
58
|
+
Pony.mail(..., :attachments => {"foo.zip" => File.read("path/to/foo.zip"), "hello.txt" => "hello!"})
|
59
|
+
|
60
|
+
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'
|
61
|
+
|
62
|
+
== Custom Headers
|
63
|
+
|
64
|
+
Pony allows you to specify custom mail headers
|
65
|
+
Pony.mail(
|
66
|
+
:to => 'me@example.com',
|
67
|
+
:headers => { "List-ID" => "...", "X-My-Custom-Header" => "what a cool custom header" }
|
68
|
+
)
|
69
|
+
|
70
|
+
== List Of Options
|
71
|
+
|
72
|
+
Options passed pretty much directly to Mail
|
73
|
+
to
|
74
|
+
cc
|
75
|
+
bcc
|
76
|
+
from
|
77
|
+
body # the plain text body
|
78
|
+
html_body # for sending html-formatted email
|
79
|
+
subject
|
80
|
+
charset # In case you need to send in utf-8 or similar
|
81
|
+
attachments # see Attachments section above
|
82
|
+
headers # see Custom headers section above
|
83
|
+
message_id
|
84
|
+
sender # Sets "envelope from" (and the Sender header)
|
85
|
+
reply_to
|
86
|
+
|
87
|
+
Other options
|
88
|
+
via # :smtp or :sendmail, see Transport section above
|
89
|
+
via_options # specify transport options, see Transport section above
|
90
|
+
|
91
|
+
== Set default options
|
92
|
+
|
93
|
+
Default options can be set so that they don't have to be repeated. The default options you set will be overriden by any options you pass in to Pony.mail()
|
94
|
+
|
95
|
+
Pony.options = { :from => 'noreply@example.com', :via => :smtp, :via_options => { :host => 'smtp.yourserver.com' } }
|
96
|
+
Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp
|
97
|
+
Pony.mail(:from => 'pony@example.com', :to => 'foo@bar') # Sends mail to foo@bar from pony@example.com using smtp
|
data/lib/pony.rb
CHANGED
@@ -1,32 +1,31 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'mail'
|
3
2
|
require 'base64'
|
4
3
|
|
5
4
|
# = The express way to send email in Ruby
|
6
|
-
#
|
5
|
+
#
|
7
6
|
# == Overview
|
8
|
-
#
|
7
|
+
#
|
9
8
|
# Ruby no longer has to be jealous of PHP's mail() function, which can send an email in a single command.
|
10
|
-
#
|
9
|
+
#
|
11
10
|
# Pony.mail(:to => 'you@example.com', :from => 'me@example.com', :subject => 'hi', :body => 'Hello there.')
|
12
11
|
# Pony.mail(:to => 'you@example.com', :html_body => '<h1>Hello there!</h1>', :body => "In case you can't read html, Hello there.")
|
13
12
|
# Pony.mail(:to => 'you@example.com', :cc => 'him@example.com', :from => 'me@example.com', :subject => 'hi', :body => 'Howsit!')
|
14
|
-
#
|
13
|
+
#
|
15
14
|
# Any option key may be omitted except for :to. For a complete list of options, see List Of Options section below.
|
16
|
-
#
|
17
|
-
#
|
15
|
+
#
|
16
|
+
#
|
18
17
|
# == Transport
|
19
|
-
#
|
18
|
+
#
|
20
19
|
# Pony uses /usr/sbin/sendmail to send mail if it is available, otherwise it uses SMTP to localhost.
|
21
|
-
#
|
20
|
+
#
|
22
21
|
# This can be over-ridden if you specify a via option:
|
23
|
-
#
|
22
|
+
#
|
24
23
|
# Pony.mail(:to => 'you@example.com', :via => :smtp) # sends via SMTP
|
25
|
-
#
|
24
|
+
#
|
26
25
|
# Pony.mail(:to => 'you@example.com', :via => :sendmail) # sends via sendmail
|
27
|
-
#
|
26
|
+
#
|
28
27
|
# You can also specify options for SMTP:
|
29
|
-
#
|
28
|
+
#
|
30
29
|
# Pony.mail(:to => 'you@example.com', :via => :smtp, :via_options => {
|
31
30
|
# :address => 'smtp.yourserver.com',
|
32
31
|
# :port => '25',
|
@@ -35,9 +34,9 @@ require 'base64'
|
|
35
34
|
# :authentication => :plain, # :plain, :login, :cram_md5, no auth by default
|
36
35
|
# :domain => "localhost.localdomain" # the HELO domain provided by the client to the server
|
37
36
|
# }
|
38
|
-
#
|
37
|
+
#
|
39
38
|
# Gmail example (with TLS/SSL)
|
40
|
-
#
|
39
|
+
#
|
41
40
|
# Pony.mail(:to => 'you@example.com', :via => :smtp, :via_options => {
|
42
41
|
# :address => 'smtp.gmail.com',
|
43
42
|
# :port => '587',
|
@@ -47,32 +46,32 @@ require 'base64'
|
|
47
46
|
# :authentication => :plain, # :plain, :login, :cram_md5, no auth by default
|
48
47
|
# :domain => "localhost.localdomain" # the HELO domain provided by the client to the server
|
49
48
|
# })
|
50
|
-
#
|
49
|
+
#
|
51
50
|
# And options for Sendmail:
|
52
|
-
#
|
51
|
+
#
|
53
52
|
# Pony.mail(:to => 'you@example.com', :via => :smtp, :via_options => {
|
54
53
|
# :location => '/path/to/sendmail' # this defaults to 'which sendmail' or '/usr/sbin/sendmail' if 'which' fails
|
55
54
|
# :arguments => '-t' # -t and -i are the defaults
|
56
55
|
# }
|
57
|
-
#
|
56
|
+
#
|
58
57
|
# == Attachments
|
59
|
-
#
|
58
|
+
#
|
60
59
|
# You can attach a file or two with the :attachments option:
|
61
|
-
#
|
60
|
+
#
|
62
61
|
# Pony.mail(..., :attachments => {"foo.zip" => File.read("path/to/foo.zip"), "hello.txt" => "hello!"})
|
63
|
-
#
|
62
|
+
#
|
64
63
|
# 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'
|
65
|
-
#
|
64
|
+
#
|
66
65
|
# == Custom Headers
|
67
|
-
#
|
66
|
+
#
|
68
67
|
# Pony allows you to specify custom mail headers
|
69
68
|
# Pony.mail(
|
70
|
-
# :to => 'me@example.com',
|
69
|
+
# :to => 'me@example.com',
|
71
70
|
# :headers => { "List-ID" => "...", "X-My-Custom-Header" => "what a cool custom header" }
|
72
71
|
# )
|
73
|
-
#
|
72
|
+
#
|
74
73
|
# == List Of Options
|
75
|
-
#
|
74
|
+
#
|
76
75
|
# Options passed pretty much directly to Mail
|
77
76
|
# to
|
78
77
|
# cc
|
@@ -82,21 +81,23 @@ require 'base64'
|
|
82
81
|
# html_body # for sending html-formatted email
|
83
82
|
# subject
|
84
83
|
# charset # In case you need to send in utf-8 or similar
|
84
|
+
# text_part_charset # for multipart messages, set the charset of the text part
|
85
85
|
# attachments # see Attachments section above
|
86
86
|
# headers # see Custom headers section above
|
87
87
|
# message_id
|
88
88
|
# sender # Sets "envelope from" (and the Sender header)
|
89
|
-
#
|
89
|
+
# reply_to
|
90
|
+
#
|
90
91
|
# Other options
|
91
92
|
# via # :smtp or :sendmail, see Transport section above
|
92
93
|
# via_options # specify transport options, see Transport section above
|
93
94
|
#
|
94
|
-
# == Set default options
|
95
|
-
#
|
95
|
+
# == Set default options
|
96
|
+
#
|
96
97
|
# Default options can be set so that they don't have to be repeated. The default options you set will be overriden by any options you pass in to Pony.mail()
|
97
|
-
#
|
98
|
+
#
|
98
99
|
# Pony.options = { :from => 'noreply@example.com', :via => :smtp, :via_options => { :host => 'smtp.yourserver.com' } }
|
99
|
-
# Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp
|
100
|
+
# Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp
|
100
101
|
# Pony.mail(:from => 'pony@example.com', :to => 'foo@bar') # Sends mail to foo@bar from pony@example.com using smtp
|
101
102
|
|
102
103
|
|
@@ -105,12 +106,12 @@ module Pony
|
|
105
106
|
@@options = {}
|
106
107
|
|
107
108
|
# Default options can be set so that they don't have to be repeated.
|
108
|
-
#
|
109
|
+
#
|
109
110
|
# Pony.options = { :from => 'noreply@example.com', :via => :smtp, :via_options => { :host => 'smtp.yourserver.com' } }
|
110
|
-
# Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp
|
111
|
+
# Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp
|
111
112
|
# Pony.mail(:from => 'pony@example.com', :to => 'foo@bar') # Sends mail to foo@bar from pony@example.com using smtp
|
112
113
|
def self.options=(value)
|
113
|
-
@@options = value
|
114
|
+
@@options = value
|
114
115
|
end
|
115
116
|
|
116
117
|
def self.options()
|
data/pony.gemspec
CHANGED
metadata
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 4
|
9
|
+
version: "1.4"
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
12
|
- Adam Wiggins
|
@@ -11,8 +15,7 @@ autorequire:
|
|
11
15
|
bindir: bin
|
12
16
|
cert_chain: []
|
13
17
|
|
14
|
-
date: 2011-
|
15
|
-
default_executable:
|
18
|
+
date: 2011-11-29 00:00:00 Z
|
16
19
|
dependencies:
|
17
20
|
- !ruby/object:Gem::Dependency
|
18
21
|
name: mail
|
@@ -22,6 +25,10 @@ dependencies:
|
|
22
25
|
requirements:
|
23
26
|
- - ">"
|
24
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 2
|
31
|
+
- 0
|
25
32
|
version: "2.0"
|
26
33
|
type: :runtime
|
27
34
|
version_requirements: *id001
|
@@ -33,6 +40,11 @@ dependencies:
|
|
33
40
|
requirements:
|
34
41
|
- - ">="
|
35
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 15
|
44
|
+
segments:
|
45
|
+
- 2
|
46
|
+
- 0
|
47
|
+
- 0
|
36
48
|
version: 2.0.0
|
37
49
|
type: :development
|
38
50
|
version_requirements: *id002
|
@@ -48,10 +60,10 @@ files:
|
|
48
60
|
- README.rdoc
|
49
61
|
- Rakefile
|
50
62
|
- pony.gemspec
|
63
|
+
- lib/foo
|
51
64
|
- lib/pony.rb
|
52
65
|
- spec/base.rb
|
53
66
|
- spec/pony_spec.rb
|
54
|
-
has_rdoc: true
|
55
67
|
homepage: http://github.com/benprew/pony
|
56
68
|
licenses: []
|
57
69
|
|
@@ -66,17 +78,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
78
|
requirements:
|
67
79
|
- - ">="
|
68
80
|
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
69
84
|
version: "0"
|
70
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
86
|
none: false
|
72
87
|
requirements:
|
73
88
|
- - ">="
|
74
89
|
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
75
93
|
version: "0"
|
76
94
|
requirements: []
|
77
95
|
|
78
96
|
rubyforge_project: pony
|
79
|
-
rubygems_version: 1.
|
97
|
+
rubygems_version: 1.8.5
|
80
98
|
signing_key:
|
81
99
|
specification_version: 3
|
82
100
|
summary: "Send email in one command: Pony.mail(:to => 'someone@example.com', :body => 'hello')"
|