質問編集履歴
1
Postfixの設定の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,3 +15,311 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
最終的には、WordPressのContact Form 7というプラグインを作って問い合わせ内容をメールで受信できるようにする予定ですが、もっといい方法があったら教えていただけると助かります。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
----以下Postfixの設定の詳細です----
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Postfixを使用してGmailアカウントからメールを送信したいのですがOperation timed outになってしまいます。
|
26
|
+
|
27
|
+
参考にしたURLは
|
28
|
+
|
29
|
+
[http://www.storange.jp/2012/01/php.html
|
30
|
+
|
31
|
+
](http://www.storange.jp/2012/01/php.html)[http://www.seekcloud.co.jp/blog/memorandum/254
|
32
|
+
|
33
|
+
](http://www.seekcloud.co.jp/blog/memorandum/254)
|
34
|
+
|
35
|
+
です。
|
36
|
+
|
37
|
+
Postfixの設定手順としては、まず
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
sudo vi /etc/postfix/sasl_passwd
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
コマンドで
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
smtp.gmail.com:587 Gmaiアカウントのユーザー名@gmail.com:パスワード
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
という内容の /etc/postfix/sasl_passwd を作成し
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
sudo postmap /etc/postfix/sasl_passwd
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
コマンドで設定を有効化しました。 /etc/postfix/main.cfの設定では
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
sudo vi /etc/postfix/main.cf
|
68
|
+
|
69
|
+
```
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
コマンドで /etc/postfix/main.cf の最下段に
|
74
|
+
|
75
|
+
```
|
76
|
+
|
77
|
+
# Minimum Postfix-specific configurations.
|
78
|
+
|
79
|
+
#mydomain_fallback = localhost
|
80
|
+
|
81
|
+
mail_owner = _postfix
|
82
|
+
|
83
|
+
setgid_group = _postdrop
|
84
|
+
|
85
|
+
relayhost=smtp.gmail.com:587
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
# Enable SASL authentication in the Postfix SMTP client.
|
90
|
+
|
91
|
+
smtp_sasl_auth_enable=yes
|
92
|
+
|
93
|
+
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
|
94
|
+
|
95
|
+
smtp_sasl_security_options= noanonymous
|
96
|
+
|
97
|
+
smtp_sasl_mechanism_filter = plain
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
# Enable Transport Layer Security (TLS), i.e. SSL.
|
102
|
+
|
103
|
+
smtp_use_tls=yes
|
104
|
+
|
105
|
+
smtp_tls_security_level=encrypt
|
106
|
+
|
107
|
+
tls_random_source=dev:/dev/urandom
|
108
|
+
|
109
|
+
```
|
110
|
+
|
111
|
+
を追加しました。
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
```
|
116
|
+
|
117
|
+
sudo postfix start
|
118
|
+
|
119
|
+
```
|
120
|
+
|
121
|
+
および
|
122
|
+
|
123
|
+
```
|
124
|
+
|
125
|
+
sudo postfix reload
|
126
|
+
|
127
|
+
```
|
128
|
+
|
129
|
+
コマンドでPostfixをリフレッシュし
|
130
|
+
|
131
|
+
```
|
132
|
+
|
133
|
+
date | mail -s test 自分のユーザー名@gmail.com
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
コマンドで送信テストを行ったところ、送信済みメールにも受信トレイにもコマンドの結果が反映されていませんでした。下記が
|
138
|
+
|
139
|
+
```
|
140
|
+
|
141
|
+
cat /var/log/mail.log
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
```
|
146
|
+
|
147
|
+
コマンドで確認したエラーログの一部です。
|
148
|
+
|
149
|
+
```
|
150
|
+
|
151
|
+
Jan 13 15:20:12 PC名 postfix/smtp[56278]: connect to example.com[93.184.216.34]:25: Operation timed out
|
152
|
+
|
153
|
+
Jan 13 15:20:12 PC名 postfix/smtp[56278]: 01BD81D21DB: to=<example@example.com>, relay=none, delay=85987, delays=85934/0.17/53/0, dsn=4.4.1, status=deferred (connect to example.com[93.184.216.34]:25: Operation timed out)
|
154
|
+
|
155
|
+
Jan 13 15:20:19 PC名 postfix/master[56270]: master exit time has arrived
|
156
|
+
|
157
|
+
Jan 13 15:21:12 PC名 postfix/smtp[56275]: connect to gmail-smtp-in.l.google.com[64.233.187.26]:25: Operation timed out
|
158
|
+
|
159
|
+
↑の同文4行
|
160
|
+
|
161
|
+
Jan 13 15:21:42 PC名 postfix/smtp[56275]: connect to alt1.gmail-smtp-in.l.google.com[74.125.25.26]:25: Operation timed out
|
162
|
+
|
163
|
+
↑の同文4行
|
164
|
+
|
165
|
+
Jan 13 15:22:12 PC名 postfix/smtp[56275]: connect to alt2.gmail-smtp-in.l.google.com[64.233.168.26]:25: Operation timed out
|
166
|
+
|
167
|
+
↑の同文4行
|
168
|
+
|
169
|
+
Jan 13 15:22:42 PC名 postfix/smtp[56275]: connect to alt3.gmail-smtp-in.l.google.com[173.194.75.27]:25: Operation timed out
|
170
|
+
|
171
|
+
↑の同文4行
|
172
|
+
|
173
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56275]: connect to alt4.gmail-smtp-in.l.google.com[173.194.204.27]:25: Operation timed out
|
174
|
+
|
175
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56275]: warning: 0FB301ACB3C: defer service failure
|
176
|
+
|
177
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56280]: warning: 119E81BEBC7: defer service failure
|
178
|
+
|
179
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56282]: connect to alt4.gmail-smtp-in.l.google.com[173.194.204.27]:25: Operation timed out
|
180
|
+
|
181
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56282]: warning: 131511D1D18: defer service failure
|
182
|
+
|
183
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56282]: 131511D1D18: to=<Gmaiアカウントのユーザー名@gmail.com>, relay=none, delay=87523, delays=87290/0.19/233/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[173.194.204.27]:25: Operation timed out)
|
184
|
+
|
185
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56284]: connect to alt4.gmail-smtp-in.l.google.com[173.194.204.27]:25: Operation timed out
|
186
|
+
|
187
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56284]: warning: 1F7B51D1CF9: defer service failure
|
188
|
+
|
189
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56284]: 1F7B51D1CF9: to=<Gmaiアカウントのユーザー名@gmail.com>, relay=none, delay=87557, delays=87324/0.22/233/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[173.194.204.27]:25: Operation timed out)
|
190
|
+
|
191
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56286]: connect to alt4.gmail-smtp-in.l.google.com[173.194.204.27]:25: Operation timed out
|
192
|
+
|
193
|
+
Jan 13 15:23:12 PC名 postfix/smtp[56286]: warning: 236DB1BC365: defer service failure
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
```
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
一応、Gmailアカウント側で安全性の低いアプリへのアクセスを有効にもしましたが、効果はありませんでした。
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
エラーログでエラーログでポートが25のままなのが気になったので/etc/postfix/main.cf の下段を
|
206
|
+
|
207
|
+
```
|
208
|
+
|
209
|
+
# Minimum Postfix-specific configurations.
|
210
|
+
|
211
|
+
#mydomain_fallback = localhost
|
212
|
+
|
213
|
+
mail_owner = _postfix
|
214
|
+
|
215
|
+
setgid_group = _postdrop
|
216
|
+
|
217
|
+
relayhost=[smtp.gmail.com]:587
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
# Enable SASL authentication in the Postfix SMTP client.
|
222
|
+
|
223
|
+
smtp_sasl_auth_enable=yes
|
224
|
+
|
225
|
+
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
|
226
|
+
|
227
|
+
smtp_sasl_security_options= noanonymous
|
228
|
+
|
229
|
+
smtp_sasl_mechanism_filter = plain
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
# Enable Transport Layer Security (TLS), i.e. SSL.
|
234
|
+
|
235
|
+
smtp_use_tls=yes
|
236
|
+
|
237
|
+
smtp_tls_security_level=encrypt
|
238
|
+
|
239
|
+
tls_random_source=dev:/dev/urandom
|
240
|
+
|
241
|
+
```
|
242
|
+
|
243
|
+
と修正しましたが解消されず、エラーログは
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
```
|
248
|
+
|
249
|
+
Jan 13 16:36:06 PC名 postfix/postfix-script[57768]: refreshing the Postfix mail system
|
250
|
+
|
251
|
+
Jan 13 16:36:06 PC名 postfix/master[53653]: reload -- version 2.11.0, configuration /etc/postfix
|
252
|
+
|
253
|
+
Jan 13 16:36:13 PC名 postfix/master[57779]: daemon started -- version 2.11.0, configuration /Library/Server/Mail/Config/postfix
|
254
|
+
|
255
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 0FB301ACB3C: from=<_www@ドメイン.com>, size=1073, nrcpt=1 (queue active)
|
256
|
+
|
257
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 01BD81D21DB: from=<ユーザー名@ドメイン.com>, size=348, nrcpt=1 (queue active)
|
258
|
+
|
259
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 119E81BEBC7: from=<_www@ドメイン.com>, size=947, nrcpt=1 (queue active)
|
260
|
+
|
261
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 131511D1D18: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
262
|
+
|
263
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 1F7B51D1CF9: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
264
|
+
|
265
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 236DB1BC365: from=<_www@ドメイン.com>, size=1098, nrcpt=1 (queue active)
|
266
|
+
|
267
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 28EF61D1C2B: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
268
|
+
|
269
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 3424C1DF15C: from=<ユーザー名@ドメイン.com>, size=330, nrcpt=1 (queue active)
|
270
|
+
|
271
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 4EB811D2BF8: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
272
|
+
|
273
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 5B1551D23E9: from=<_www@ドメイン.com>, size=947, nrcpt=1 (queue active)
|
274
|
+
|
275
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 5FD811BE974: from=<_www@ドメイン.com>, size=834, nrcpt=1 (queue active)
|
276
|
+
|
277
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 6E8921BC324: from=<_www@ドメイン.com>, size=1098, nrcpt=1 (queue active)
|
278
|
+
|
279
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 6F7D11D1F6C: from=<ユーザー名@ドメイン.com>, size=331, nrcpt=1 (queue active)
|
280
|
+
|
281
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 721431E066A: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
282
|
+
|
283
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 7BC201E09B9: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
284
|
+
|
285
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 8411A1DF9DF: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
286
|
+
|
287
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 8A63D1BC2BD: from=<_www@ドメイン.com>, size=1098, nrcpt=1 (queue active)
|
288
|
+
|
289
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 950B41DEDBE: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
290
|
+
|
291
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 9BA9C1D2266: from=<ユーザー名@ドメイン.com>, size=351, nrcpt=1 (queue active)
|
292
|
+
|
293
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 9DC981D2C41: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
294
|
+
|
295
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: 9DF491BEE5F: from=<_www@ドメイン.com>, size=822, nrcpt=1 (queue active)
|
296
|
+
|
297
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: A40971D1A70: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
298
|
+
|
299
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: BC38A1DDB28: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
300
|
+
|
301
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: C45201BEA56: from=<_www@ドメイン.com>, size=832, nrcpt=1 (queue active)
|
302
|
+
|
303
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: CDD0D1D2268: from=<ユーザー名@ドメイン.com>, size=351, nrcpt=1 (queue active)
|
304
|
+
|
305
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: DCF8D1DFB65: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
306
|
+
|
307
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: E01FE1BC250: from=<_www@ドメイン.com>, size=1060, nrcpt=1 (queue active)
|
308
|
+
|
309
|
+
Jan 13 16:36:13 PC名 postfix/qmgr[57781]: E08341BCBCD: from=<_www@ドメイン.com>, size=1052, nrcpt=1 (queue active)
|
310
|
+
|
311
|
+
Jan 13 16:36:14 PC名 postfix/pickup[57780]: 5BEA11E1CD6: uid=501 from=<ユーザー名>
|
312
|
+
|
313
|
+
Jan 13 16:36:14 ドメイン postfix/cleanup[57782]: 5BEA11E1CD6: message-id=<20160113073614.5BEA11E1CD6@ドメイン.com>
|
314
|
+
|
315
|
+
Jan 13 16:36:14 PC名 postfix/qmgr[57781]: 5BEA11E1CD6: from=<ユーザー名@ドメイン.com>, size=359, nrcpt=1 (queue active)
|
316
|
+
|
317
|
+
Jan 13 16:37:06 PC名 postfix/smtp[57787]: connect to example.com[93.184.216.34]:25: Operation timed out
|
318
|
+
|
319
|
+
Jan 13 16:37:06 PC名 postfix/smtp[57787]: 01BD81D21DB: to=<example@example.com>, relay=none, delay=90601, delays=90548/0.23/53/0, dsn=4.4.1, status=deferred (connect to example.com[93.184.216.34]:25: Operation timed out)
|
320
|
+
|
321
|
+
Jan 13 16:37:13 PC名 postfix/master[57779]: master exit time has arrived
|
322
|
+
|
323
|
+
```
|
324
|
+
|
325
|
+
となりました。
|