Skip to content

Commit 35fe9c6

Browse files
Merge pull request #120719 from vseanreesermsft/internal-merge-9.0-2025-10-14-1155
Merging internal commits for release/9.0
2 parents 0d09ce7 + 16550dd commit 35fe9c6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpConnection.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,14 @@ private static void SendEHelloCallback(IAsyncResult result)
628628

629629
private bool SendHello()
630630
{
631+
if (_connection._enableSsl)
632+
{
633+
// We only try HELO command if EHLO was not recognized. Server cannot
634+
// advertise STARTTLS in older HELO command, thus if TLS is required,
635+
// we can fail early.
636+
throw new SmtpException(SR.MailServerDoesNotSupportStartTls);
637+
}
638+
631639
IAsyncResult result = HelloCommand.BeginSend(_connection, _connection._client!._clientDomain, s_sendHelloCallback, this);
632640
//if ehello isn't supported, assume basic auth
633641
if (result.CompletedSynchronously)

0 commit comments

Comments
 (0)