C# 发邮件 服务器响应为: 5.7.0 Must issue a STARTTLS command first

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. d21sm2344514and.26

SMTP 服务器要求安全连接或客户端未通过身份验证。 服务器响应为: 5.7.0 Must issue a STARTTLS command first. i6sm4954143tid.5

今天用Gmail的发送邮件,返回这错误.查了下是因为Gmail要求把ssl加密打开.

加上这代码:client.EnableSsl = true;