How to hide email address
I am making an algorithm that sends emails, I am able to send the emails normally, but I would like to be able to hide the email address of the one who is sending to the recipient.
Note: when I talk about hiding the email address, I mean the email Header, in which the sender's name appears and the email address enters ''. I would like to hide the address who comes within the signs of minor and major.
Code C# :
public HttpResponseMessage SendMail()
{
try
{
MailMessage _mailMessage = new MailMessage();
_mailMessage.From = new MailAddress("emailRemetente", "nomeRemetente");
_mailMessage.CC.Add(emailDestinatario);
_mailMessage.Subject = "Título do email";
_mailMessage.IsBodyHtml = true;
_mailMessage.Body = "Corpo do email HTML";
SmtpClient _smtpClient = new SmtpClient("smtpclient", Convert.ToInt32(porta));
_smtpClient.UseDefaultCredentials = false;
_smtpClient.Credentials = new NetworkCredential("emailRemetente", "senhaRemetente");
_smtpClient.EnableSsl = true;
_smtpClient.Send(_mailMessage);
return Request.CreateResponse(HttpStatusCode.OK, true);
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
}
}
}
I gave a read on this link : https://docs.microsoft.com/pt-br/dotnet/api/system.net.mail.mailmessage.bcc?view=netframework-4.8 but I didn't quite understand.
1 answers
Instead of using the CC method, use the Bcc, it is the CCO field (with hidden copy) in English.
In Practice:
Instead of using the _mailMessage.CC.Add (recipient email)
Use or _mailMessage. Bcc .Add (recipient email).