when you create MailMessage object the property "
From" of
MailMessage object is the actual from address where client see where the mail comes.
string mailFrom = "test@gmail.com";
var mailMessage = new MailMessage
{
Subject = "subject",
Body = "body",
IsBodyHtml = true,
From = new MailAddress(mailFrom)
};
var smtpClient = new SmtpClient
{
Host = Configuration.Current.Smtp.Host,
Port = Configuration.Current.Smtp.Port,
};
if (!string.IsNullOrEmpty(Configuration.Current.Smtp.UserId))
{
smtpClient.Credentials = new NetworkCredential(Configuration.Current.Smtp.UserId, Configuration.Current.Smtp.Password);
}
mailClient.Send(message);