protected void btnSubmit_Click(object sender, EventArgs e)
{
MailMessage msg = new MailMessage();
msg.From = new MailAddress(txtlogfrom.Text);
msg.To.Add(txtTo.Text);
msg.Subject = txtSubject.Text;
msg.Body = txtBody.Text;
using (SmtpClient client = new SmtpClient())
{
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(txtlogfrom.Text, password);
client.Host = "smtp.gmail.com";
client.Port = 587;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(msg);
}
}
当我们提供用户名和密码时,上述代码有效
但是当他向我发送邮件时,我需要将自动回复邮件发送给发件人。
帮我找到解决方案
提前致谢