在網路上能夠找到很多的訊息去設定,在這裡要說明的是 relayhost 的設定,做一個記錄。
網路上找到有關
vi /etc/postfix/main.cf
的設定,都會讓我們設定成relayhost = [smtp.office365.com]:587但是,我在使用時,卻會一直報錯,說我未經驗證的發送信件,我猜測主要是沒有取得與 office365 之間的憑證,才會出錯。
在找到微軟關於 office365 的 smtp 網頁說明後,找到了這一段
https://support.office.com/en-us/article/How-to-set-up-a-multifunction-device-or-application-to-send-email-using-Office-365-69f58e99-c550-4274-ad18-c805d654b4c4
當有購買 office365 的服務,也使用他們的信箱時,在 dns server 會看到這一段,因為這是必要設定的,所以把剛剛的
https://support.office.com/en-us/article/How-to-set-up-a-multifunction-device-or-application-to-send-email-using-Office-365-69f58e99-c550-4274-ad18-c805d654b4c4
這一段的重點就是在於「yourcontosodomain-com.mail.protection.outlook.com」Option 3: Configure a connector to send mail using Office 365 SMTP relayThis option is more difficult to implement than the others. Only choose this option when:
SMTP client submission (Option 1) is not compatible with your business needs or with your device You can't use direct send (Option 2) because you must send email to external recipients.SMTP relay lets Office 365 relay emails on your behalf by using your public IP address (or a certificate) to authenticate Office 365. To do this, you'll need to set up a connector for your Office 365 account, which is what makes this a more complicated configuration.
Settings for Office 365 SMTP relay
Device or application setting Value Server/smart host Your MX endpoint, e.g. yourcontosodomain-com.mail.protection.outlook.com Port Port 25 TLS/StartTLS Enabled Email address Any email address for one of your Office 365 verified domains. This email address does not need a mailbox.
當有購買 office365 的服務,也使用他們的信箱時,在 dns server 會看到這一段,因為這是必要設定的,所以把剛剛的
relayhost = [smtp.office365.com]:587改成
relayhost = [yourcontosodomain-com.mail.protection.outlook.com]:25
就能夠順利的寄出,這只是重點說明,欲參考的人,請連https://linuxhowtoguide.blogspot.tw/2017/03/how-to-configure-postfix-smtp-relay.html
做其他的設定作為參考
https://brightnormallife.blogspot.com