Send SMTP email using System.Net.Mail via Exchange Online (Office 365)

后端 未结 8 573
悲&欢浪女
悲&欢浪女 2020-11-29 23:34

We are testing the new Office 365 beta, and i have a mail account on the Exchange Online service. Now I\'m trying to connect a LOB application that can send smtp emails from

8条回答
  •  半阙折子戏
    2020-11-30 00:19

    I've ported c# code used to work against smtp.google.com:587 to work via office365 without success. Tried all combinations of Credential before/after using Ssl and almost every recommendation made on the Internet - w/o success (got 5.7.1 .... error).

    Finally got this line from somewhere as last resort, just before .Send(message)

    smtpClient.TargetName = "STARTTLS/smtp.office365.com";
    

    Since then - every send() is big success.

提交回复
热议问题