ruby-sendmail 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/sendmail +83 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b2aa7123009db43f7195d1725385ff4c02bd5b871d2c340c3385b9f949000602
|
4
|
+
data.tar.gz: 2fce51b9e84f29e32d5cf92c5ef9a3f05f67858a4fdb76443e83decfa038b3f0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b5fae9c7b1dbd8cb0e4231e01d950aab617a4f6da7a5653a0710ce178d55e1a293b0a173d5ccb99dd075fb6aa98ba9ce18c6cde198289eabdfa6689885acae41
|
7
|
+
data.tar.gz: b8771101769c0d8d9a8b75aa297813cab250f7c1e8c5773a9736e6a5c2edc2da7efe84eb2298e6adb3837144cacbdcab040fe6793cf2b810ac4398b3e3251e03
|
data/bin/sendmail
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
require 'socket'
|
4
|
+
require 'mail'
|
5
|
+
|
6
|
+
themail = {
|
7
|
+
from: "#{ENV['LOGNAME']}@#{Socket.gethostname}",
|
8
|
+
to: 'mail@example.com',
|
9
|
+
subject: '',
|
10
|
+
body: ''
|
11
|
+
}
|
12
|
+
|
13
|
+
options = {
|
14
|
+
address: 'localhost',
|
15
|
+
port: 25,
|
16
|
+
domain: Socket.gethostname,
|
17
|
+
user_name: '',
|
18
|
+
password: '',
|
19
|
+
authentication: 'plain',
|
20
|
+
ssl: false
|
21
|
+
}
|
22
|
+
|
23
|
+
OptionParser.new do |opts|
|
24
|
+
opts.banner = "Usage: sendmail [options]"
|
25
|
+
|
26
|
+
opts.on("-fFROM", "--from=FROM", "From") do |v|
|
27
|
+
themail[:from] = v
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.on("-tTO", "--to=TO", "To") do |v|
|
31
|
+
themail[:to] = v
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on("-sSUBJECT", "--subject=SUBJECT", "Subject") do |v|
|
35
|
+
themail[:subject] = v
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
opts.on("-bBODY", "--body=BODY", "Message body or - for stdin") do |v|
|
40
|
+
themail[:body] = v == '-' ? STDIN.read : v
|
41
|
+
end
|
42
|
+
|
43
|
+
opts.on("-cHOST", "--host=HOST", "SMTP Host") do |v|
|
44
|
+
options[:address] = v
|
45
|
+
end
|
46
|
+
|
47
|
+
opts.on("-dPORT", "--port=PORT", "SMTP Port (25)") do |v|
|
48
|
+
options[:port] = v
|
49
|
+
end
|
50
|
+
|
51
|
+
opts.on("-uUSERNAME", "--username=USERNAME", "Username") do |v|
|
52
|
+
options[:user_name] = v
|
53
|
+
end
|
54
|
+
|
55
|
+
opts.on("-pPASSWORD", "--password=PASSWORD", "Password") do |v|
|
56
|
+
options[:password] = v
|
57
|
+
end
|
58
|
+
|
59
|
+
opts.on("-z", "--ssl", "Encryption Port SSL/TLS") do
|
60
|
+
options[:ssl] = true
|
61
|
+
end
|
62
|
+
|
63
|
+
opts.on("-h", "--help", "Prints this help") do
|
64
|
+
puts opts
|
65
|
+
exit
|
66
|
+
end
|
67
|
+
|
68
|
+
end.parse!
|
69
|
+
|
70
|
+
mail = Mail.new do
|
71
|
+
from themail[:from]
|
72
|
+
to themail[:to]
|
73
|
+
subject themail[:subject]
|
74
|
+
body themail[:body]
|
75
|
+
end
|
76
|
+
|
77
|
+
begin
|
78
|
+
mail.delivery_method :smtp, options
|
79
|
+
mail.deliver
|
80
|
+
rescue StandardError => e
|
81
|
+
puts e
|
82
|
+
exit 1
|
83
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby-sendmail
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sascha Spreitzer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-05-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mail
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.8.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.8.1
|
27
|
+
description:
|
28
|
+
email: sascha@spreitzer.ch
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- bin/sendmail
|
34
|
+
homepage: https://rubygems.org/gems/ruby-sendmail
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubygems_version: 3.4.10
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: Ruby gem and script to send emails
|
57
|
+
test_files: []
|