Home > Net >  Email does not accept replies SMTP C#
Email does not accept replies SMTP C#

Time:09-04

I send an email via SMTP google and my code is working fine. What I want is to set this email does not accept replies in the SMTP setting.

Working Code

public ActionResult SendEmail()
{
    var fromAddress = new MailAddress("[email protected]", "From Name");
    var toAddress = new MailAddress("[email protected]", "To Name");
    const string fromPassword = "password";
    const string subject = "Subject";
    const string body = "<p>Hello</p>";

    var smtp = new SmtpClient
    {
        Host = "smtp.gmail.com",
        Port = 587,
        EnableSsl = true,
        DeliveryMethod = SmtpDeliveryMethod.Network,
        UseDefaultCredentials = false,
        Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
    };
    using (var message = new MailMessage(fromAddress, toAddress)
    {
        Subject = subject,
        Body = body,
        IsBodyHtml = true
        })
    {
        smtp.Send(message);
    }
    return View();
}

Google Mailbox

enter image description here

I don't want the Reply button highlighted in blue

CodePudding user response:

As far as I am aware, it is not possible through SMTP to disable a client's reply function.

Instead, you could create a no-reply address with a vacation responder to alert individuals that the inbox is not being monitored (possibly including where to go if a user does need to reach out to someone).

  • Related