sendmail-command 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c587e468d3d0a5144e36378bc774f1d91db3c4c
4
+ data.tar.gz: e528f2056a32dfb1ae0dc539ea535d0124b9661c
5
+ SHA512:
6
+ metadata.gz: 7cd8af00718311cc9629dcfb0acdd33d1402d4915658f0c456c9012dd36c7475d87ce5c42016e239a3bf490200f05c95128d99f3f7a974e31674fd02b27ec78e
7
+ data.tar.gz: dfa9ccc194b29f2b8394dfde25d6f569e340243f9bf86babc19f18d9965277a87f87072b42f598e342d9bf52f935b74dd5858ec2c04cecbc6d1073fefda86887
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ pkg/
@@ -0,0 +1,29 @@
1
+ # Sendmail
2
+
3
+ Sendmail command in Ruby.
4
+
5
+ ## Usage
6
+
7
+ Sendmail.sendmail! "Subject: Hello\n\nText...", to: "to@example.tld"
8
+ #=> true/false
9
+
10
+ include Sendmail
11
+
12
+ sendmail! "Subject: Hello\n\nText...", to: "to@example.tld"
13
+ #=> true/false
14
+
15
+ Change sendmail bin :
16
+
17
+ Sendmail.bin = "/path/to/sendmail"
18
+
19
+ Default bin is `"sendmail"`.
20
+
21
+ Change sendmail arguments :
22
+
23
+ Sendmail.args = "-it"
24
+
25
+ Default arguments is `"-i"`
26
+
27
+ ## Install
28
+
29
+ gem install sendmail-command
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,27 @@
1
+ module Sendmail
2
+ class << self
3
+ attr_accessor :bin, :args
4
+
5
+ def bin
6
+ @bin ||= "sendmail"
7
+ end
8
+
9
+ def args
10
+ @args ||= "-i"
11
+ end
12
+ end
13
+
14
+ def sendmail!(mail, opts = {})
15
+ bin = opts[:bin] || Sendmail.bin
16
+ args = opts[:args] || Sendmail.args
17
+ command = [bin, args]
18
+ command << opts[:to] if opts.key?(:to)
19
+
20
+ io = IO.popen(command, "w+b")
21
+ io.write(mail)
22
+ io.close
23
+ $?.to_i == 0
24
+ end
25
+
26
+ module_function :sendmail!
27
+ end
@@ -0,0 +1,10 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "sendmail-command"
3
+ spec.version = "1.0"
4
+ spec.authors = ["Benoit MARTIN-CHAVE"]
5
+ spec.email = ["benoitmartinchave@gmail.com"]
6
+ spec.summary = %q{Sendmail command in Ruby.}
7
+ spec.homepage = "http://github.com/BenoitMC/sendmail"
8
+ spec.license = "WTFPL"
9
+ spec.files = `git ls-files -z`.split("\x0")
10
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sendmail-command
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Benoit MARTIN-CHAVE
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-22 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - benoitmartinchave@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - README.md
22
+ - Rakefile
23
+ - lib/sendmail.rb
24
+ - sendmail-command.gemspec
25
+ homepage: http://github.com/BenoitMC/sendmail
26
+ licenses:
27
+ - WTFPL
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 2.2.2
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Sendmail command in Ruby.
49
+ test_files: []