.Net SmtpClient protocol error?

Fs 5 Reputation points
2024-05-03T09:12:57.5866667+00:00

Hi,

having an issue sending EMails using System.Net.Mail.SmtpClient to a mail server using postfix and postscreen using postscreen_greet_action = enforce.

It seams, that the SmtpClient fails to process all greetings lines prior to sending the EHLO command.

In the .Net trace I find: Server / Client:

220-Welcome, please wait...

EHLO client-host-name

250-mailserver FQDN

250-SIZE 25534336

250-ETRN

250-STARTTLS

250-ENHANCEDSTATUSCODES

250-8BITMIME

250-DSN

250 CHUNKING

Which matches to logging on the mail server. It say's that the client "talks" too early, as it's not waiting for the complete (multi-line) server message.

Please advise, how to use the SmtpClient in this szenario. Thanks.

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,136 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 28,076 Reputation points Microsoft Vendor
    2024-05-03T14:37:27.1+00:00

    Hi @Fs ,

    You can try adjusting the timeout settings of the SmtpClient to give it more time to receive the complete greeting message from the server before sending the EHLO command. You can set the Timeout property of the SmtpClient to a higher value to allow more time for the server's greeting message to be received.

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments