ews_mail 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ews_mail.rb +43 -0
  3. metadata +61 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c72418341d146ce815b30aa223a8d4920ca3538f
4
+ data.tar.gz: ca1b51dc316e407498bdad315b52a1ff94b05092
5
+ SHA512:
6
+ metadata.gz: db7652d6870ef0312b9614205b8d6f4e9062954ac5bba9fe98774949f52b03a6041d6b5817f6af4f3af4c0f0148d91429804b285aa15c5b7db2d711799d9675d
7
+ data.tar.gz: 5c97bd62daf5aadaf3e85319abde554c5d87ae88ad556623a674875dd5e300f66eddd3a5ff75365483996231b0e823b18317d09b570745884b50ccff61c1d2f4
data/lib/ews_mail.rb ADDED
@@ -0,0 +1,43 @@
1
+ require 'savon'
2
+
3
+ module EWS
4
+ module Mail
5
+
6
+ WSDL = 'https://outlook.office365.com/EWS/Services.wsdl'
7
+ ENDPOINT = 'https://outlook.office365.com/EWS/Exchange.asmx'
8
+ NAMESPACES = {
9
+ 'xmlns:t' =>
10
+ 'http://schemas.microsoft.com/exchange/services/2006/types'
11
+ }
12
+
13
+ def self.send(username:, password:, rcpts:, subject:, body:)
14
+ c = Savon.client({
15
+ wsdl: WSDL,
16
+ endpoint: ENDPOINT,
17
+ basic_auth: [username, password],
18
+ namespaces: NAMESPACES,
19
+ })
20
+
21
+ message = {
22
+ 'tns:Items' => {
23
+ 't:Message' => {
24
+ 't:Subject' => subject,
25
+ 't:Body' => body,
26
+ 't:ToRecipients' => {
27
+ 't:Mailbox' => [*rcpts].map do |v|
28
+ { 't:EmailAddress' => v }
29
+ end
30
+ },
31
+ attributes!: {
32
+ 't:Body' => { 'BodyType' => 'Text' }
33
+ }
34
+ }
35
+ },
36
+ }
37
+ attributes = { 'MessageDisposition' => 'Send' }
38
+
39
+ c.call(:create_item, message: message, attributes: attributes)
40
+ end
41
+
42
+ end
43
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ews_mail
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Gray Wolf
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: savon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ description: |
28
+ Send mails via EWS, useful for corporation environment
29
+ like ours which has outlook via office365, but firewall
30
+ block SMTP (don't ask me why, dunno).
31
+ email: wolf@wolfsden.cz
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - lib/ews_mail.rb
37
+ homepage: https://github.com/graywolf/ews_mail
38
+ licenses:
39
+ - MIT
40
+ metadata: {}
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project:
57
+ rubygems_version: 2.6.8
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: Send simple mails via EWS
61
+ test_files: []