简体   繁体   中英

Restricting replyTo Field in SMTP (C#)

Is it possible to restrict the user to reply to a mail sent via SMTP server? I have tried using obsolete before the method name but still reply mail could not be blocked

void sendmail()

    {
            string to = "abc@xyz.com";
            string from = "def@abc.com";
            MailMessage message = new MailMessage(from, to);
            message.Subject = "Using the new SMTP client.";
            message.Body = @"Test"
            SmtpClient client = new SmtpClient(server);
            client.UseDefaultCredentials = true;
    }

above is the sample code.

As others have said in the comments, it is impractical/impossible (depending on level of access to their computers) to prevent a user replying to an email. However, you can prevent an exchange email account from receiving emails by applying delivery restrictions - telling the account to only receive emails from itself:

On the server running Exchange start "Active Directory Users and Computers" Find the account.

Double click the account to open its properties (or right click and select "Properties")

On the "Exchange General" tab, click [Delivery Restrictions...].

Under "Message restrictions" check "From authenticated users only". Then select the radio button "Only from" and add the user account. It is important that you add a user account here otherwise Exchange will accept email from any authenticated user.

Click [OK] to close the "Delivery Restrictions" dialog and [OK] again to close the account properties dialog.

Using this method, to any other user it will look like the account does not exist and they will receive delivery failed messages.

This an other methods are detailed here: http://www.cryer.co.uk/brian/msexchange/exch_howto_disable_delivery.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM