質問編集履歴

6

訂正

2019/08/05 11:54

投稿

kazuyakazuya
kazuyakazuya

スコア193

test CHANGED
File without changes
test CHANGED
@@ -148,7 +148,7 @@
148
148
 
149
149
  smtp.starttls
150
150
 
151
- smtp.authenticate("kazuya0409","パスワード",":plain")
151
+ smtp.authenticate("matsukazu0409","パスワード",":plain")
152
152
 
153
153
  smtp.open_message_stream("matsukazu0409@gmail.com","matsu-kazu4@ezweb.ne.jp"){|mail|
154
154
 

5

追記

2019/08/05 11:54

投稿

kazuyakazuya
kazuyakazuya

スコア193

test CHANGED
File without changes
test CHANGED
@@ -135,3 +135,23 @@
135
135
  from sample2.rb:2:in `<main>'
136
136
 
137
137
  ```
138
+
139
+
140
+
141
+ ```ruby
142
+
143
+ require 'net/smtp'
144
+
145
+ s = Net::SMTP.new("smtp.gmail.com","587")
146
+
147
+ smtp = s.start("smtp.gmail.com","587")#ポートを記入しないとエラーになる。
148
+
149
+ smtp.starttls
150
+
151
+ smtp.authenticate("kazuya0409","パスワード",":plain")
152
+
153
+ smtp.open_message_stream("matsukazu0409@gmail.com","matsu-kazu4@ezweb.ne.jp"){|mail|
154
+
155
+ }
156
+
157
+ ```

4

追記

2019/08/05 09:06

投稿

kazuyakazuya
kazuyakazuya

スコア193

test CHANGED
File without changes
test CHANGED
@@ -91,3 +91,47 @@
91
91
  }
92
92
 
93
93
  ```
94
+
95
+
96
+
97
+ ```cmd
98
+
99
+ #starttls追記前
100
+
101
+ C:\Users\u16154\Desktop\ruby_lesson>ruby sample2.rb
102
+
103
+ C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:981:in `check_auth_response': 530 5.7.0 Must issue a STARTTLS command first. y128sm103149625pgy.41 - gsmtp (Net::SMTPAuthenticationError)
104
+
105
+ from C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:736:in `auth_plain'
106
+
107
+ from C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:728:in `authenticate'
108
+
109
+ from C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:565:in `do_start'
110
+
111
+ from C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:518:in `start'
112
+
113
+ from sample2.rb:2:in `<main>'
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ #starttls追記後
122
+
123
+ C:\Users\u16154\Desktop\ruby_lesson>ruby sample2.rb
124
+
125
+ C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:981:in `check_auth_response': 530 5.7.0 Must issue a STARTTLS command first. u16sm15528930pjb.2 - gsmtp (Net::SMTPAuthenticationError)
126
+
127
+ from C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:736:in `auth_plain'
128
+
129
+ from C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:728:in `authenticate'
130
+
131
+ from C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:565:in `do_start'
132
+
133
+ from C:/Ruby24-x64/lib/ruby/2.4.0/net/smtp.rb:518:in `start'
134
+
135
+ from sample2.rb:2:in `<main>'
136
+
137
+ ```

3

追記

2019/08/05 08:29

投稿

kazuyakazuya
kazuyakazuya

スコア193

test CHANGED
File without changes
test CHANGED
@@ -69,3 +69,25 @@
69
69
 
70
70
 
71
71
  原因が分からないので参考になるリンクまたは説明をお願いします。
72
+
73
+
74
+
75
+
76
+
77
+ **追記**
78
+
79
+ ```ruby
80
+
81
+ require 'net/smtp'
82
+
83
+ Net::SMTP.new("smtp.gmail.com",587).start("matsukazu0409","パスワード",":plain"){|f|
84
+
85
+ f.starttls
86
+
87
+ f.open_message_stream("matsukazu0409@gmail.com", "matsu-kazu4@ezweb.ne.jp"){|m|
88
+
89
+ }
90
+
91
+ }
92
+
93
+ ```

2

追記

2019/08/05 08:23

投稿

kazuyakazuya
kazuyakazuya

スコア193

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  Net::SMTP.new("smtp.gmail.com",587).start("matsukazu0409","パスワード",":plain"){|f|
16
16
 
17
- smtp.open_message_stream("matsukazu0409@gmail.com", "matsu-kazu4@ezweb.ne.jp"){|m|
17
+ f.open_message_stream("matsukazu0409@gmail.com", "matsu-kazu4@ezweb.ne.jp"){|m|
18
18
 
19
19
  }
20
20
 

1

追記

2019/08/05 08:15

投稿

kazuyakazuya
kazuyakazuya

スコア193

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  ([STARTTLS](http://blog.smtps.jp/entry/2017/09/07/114820))
46
46
 
47
-
47
+ 一度非暗号化で通信を開始した後 STARTTLS コマンドを実行し、途中から暗号化ありの通信にアップグレードする手法
48
48
 
49
49
 
50
50