家用 adsl + centos 6.6
要求,外部 ip 成日變,想變動時用 mail 通知自己,順便將 log 寄出。
唔打算自設 mail server!
請大家俾d意見同方法。
2015-01-30 原來換 mint 17.1 可以。
centos 6 試足幾日都唔惦,玩到死埋機。
結果換跑道用 mint 17.1 xfce就ok。
在 mint 環境下,只要在 ~/.msmtprc 做以下兩個設定,可以發信。好滿足!
port 465
tls_starttls off
當然,我順手試埋 port 587 同 tls_starttls on 的各種組合,就只有上面的一組能行。
以下是相關的資料:
sudo apt-get install msmtp
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/universe msmtp i386 1.4.31-1 [116 kB]
$ vi ~/.msmtprc
account default
host smtp.gmail.com
from xxxxxx@gmail.com
auth on
#重點1 必須是 port 465
port 465
user xxxxxx@gmail.com
password *****************
logfile ~/.msmtp.log
tls on
#重點2 tls_starttls 必須是 off
tls_starttls off
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
$ echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |msmtp --debug --from=default -t xxxxxx@gmail.com
ignoring system configuration file /etc/msmtprc: No such file or directory
loaded user configuration file /home/storylai/.msmtprc
falling back to default account
using account default from /home/xxxxxx/.msmtprc
host = smtp.gmail.com
port = 465
timeout = off
protocol = smtp
domain = localhost
auth = choose
user = storylai@gmail.com
password = *
passwordeval = (not set)
ntlmdomain = (not set)
tls = on
tls_starttls = off
tls_trust_file = /etc/ssl/certs/ca-certificates.crt
tls_crl_file = (not set)
tls_fingerprint = (not set)
tls_key_file = (not set)
tls_cert_file = (not set)
tls_certcheck = on
tls_force_sslv3 = off
tls_min_dh_prime_bits = (not set)
tls_priorities = (not set)
auto_from = off
maildomain = (not set)
from = default
dsn_notify = (not set)
dsn_return = (not set)
keepbcc = off
logfile = /home/xxxxxx/.msmtp.log
syslog = (not set)
aliases = (not set)
reading recipients from the command line and the mail
TLS certificate information:
Owner:
Common Name: smtp.gmail.com
Organization: Google Inc
Locality: Mountain View
State or Province: California
Country: US
Issuer:
Common Name: Google Internet Authority G2
Organization: Google Inc
Country: US
Validity:
Activation time: Tue 15 Jul 2014 04:40:38 PM CST
Expiration time: Sat 04 Apr 2015 11:15:55 PM CST
Fingerprints:
SHA1: 9C:0A:CC:93:1D:E7:51:37:90:61:6B:..........
MD5: E7:48:1D:0B:99:4A:C3:A8:31:86:E5:..........
<-- -="" 220="" br="" esmtp="" g6sm10245709pdo.76="" gsmtp="" mx.google.com="">--> EHLO localhost
<-- 250-mx.google.com="" at="" br="" service="" your=""><-- 250-size="" 35882577="" br=""><-- 250-8bitmime="" br=""><-- 250-auth="" br="" login="" plain-clienttoken="" plain="" xoauth2="" xoauth=""><-- 250-enhancedstatuscodes="" br=""><-- 250-pipelining="" br=""><-- 250-chunking="" br=""><-- 250="" br="" smtputf8="">--> AUTH PLAIN AHN0b3J5bGFpQGdtYWlsLmNvbQAyNDA0ODkxMjM0
<-- 2.7.0="" 235="" accepted="" br="">--> MAIL FROM:
--> RCPT TO:
--> DATA
<-- -="" 2.1.0="" 250="" br="" g6sm10245709pdo.76="" gsmtp="" ok=""><-- -="" 2.1.5="" 250="" br="" g6sm10245709pdo.76="" gsmtp="" ok=""><-- -="" 354="" ahead="" br="" g6sm10245709pdo.76="" go="" gsmtp="" nbsp="">--> Subject: Test Mail
-->
--> This is a test mail
--> .
<-- -="" 1422612091="" 2.0.0="" 250="" br="" g6sm10245709pdo.76="" gsmtp="" ok="">--> QUIT
<-- font=""> 221 2.0.0 closing connection g6sm10245709pdo.76 - gsmtp-->-->-->-->-->
沒有留言:
張貼留言