質問編集履歴
4
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -60,7 +60,49 @@
|
|
60
60
|
|
61
61
|
```ruby
|
62
62
|
|
63
|
+
require 'net/smtp'
|
64
|
+
|
65
|
+
require 'mail'
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
a = Net::SMTP.new("smtp.sendgrid.net", 587)
|
70
|
+
|
71
|
+
a.enable_starttls
|
72
|
+
|
73
|
+
a.start('localhost'){|smtp|
|
74
|
+
|
75
|
+
smtp.authenticate("id","password")
|
76
|
+
|
77
|
+
smtp.send_message(<<-EndOfMail, '送信元', '送信先')
|
78
|
+
|
79
|
+
From: Your Name <from@example.com>
|
80
|
+
|
81
|
+
To: Dest Address <to@example.net>
|
82
|
+
|
83
|
+
Subject: test mail
|
84
|
+
|
85
|
+
Date: Sat, 23 Jun 2019 18:20:50 +0900
|
86
|
+
|
87
|
+
Message-Id: <unique.message.id.string@yourhost.example.com>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
ここにファイルを添付させるコードを記入
|
92
|
+
|
63
93
|
#{mail = Mail.new do add_file "./aaa.jpg" end}
|
94
|
+
|
95
|
+
This is a test mail.
|
96
|
+
|
97
|
+
EndOfMail
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
|
64
106
|
|
65
107
|
```
|
66
108
|
|
3
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,11 +14,11 @@
|
|
14
14
|
|
15
15
|
a.enable_starttls
|
16
16
|
|
17
|
-
a.start('
|
17
|
+
a.start('localhost'){|smtp|
|
18
18
|
|
19
19
|
smtp.authenticate("id","password")
|
20
20
|
|
21
|
-
smtp.send_message(<<-EndOfMail, '
|
21
|
+
smtp.send_message(<<-EndOfMail, '送信元', '送信先')
|
22
22
|
|
23
23
|
From: Your Name <from@example.com>
|
24
24
|
|
2
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -66,9 +66,7 @@
|
|
66
66
|
|
67
67
|
aaa.jpgを添付しています。以下ファイル構成(実行するのはsample.rb)
|
68
68
|
|
69
|
-
![イメージ説明](
|
69
|
+
![イメージ説明](b258edf88eccafde143270ea5b27b6a9.png)
|
70
|
-
|
71
|
-
|
72
70
|
|
73
71
|
プログラムを実行すると・・・
|
74
72
|
|
1
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
a.start('matsukazu0409@gmail.com'){|smtp|
|
18
18
|
|
19
|
-
smtp.authenticate("
|
19
|
+
smtp.authenticate("id","password")
|
20
20
|
|
21
21
|
smtp.send_message(<<-EndOfMail, 'matsukazu0409@gmail.com', 'matsu-kazu4@ezweb.ne.jp')
|
22
22
|
|