提交表单后如何保持联系我们的表单电子邮件

问题描述

我创建了一个联系我们页面,当用户填写姓名、电子邮件和消息时 我期待收到来自填写表格的人的电子邮件。 但不知何故,发件人电子邮件是我的页面的域电子邮件,而不是来自联系我们请求者的电子邮件邮件消息的表单电子邮件为“发件人”,但是当我收到它时,它是不同的 - smtp.gmail 配置电子邮件是我看到的

contact us form

private async Task SendAsync(MimeMessage mailMessage)
    {
        using (var client = new SmtpClient())
        {
            try
            {
                await client.ConnectAsync(_emailConfig.SmtpServer,_emailConfig.Port,true);
                client.AuthenticationMechanisms.Remove("XOAUTH2");
                await client.AuthenticateAsync(_emailConfig.UserName,_emailConfig.Password);

                await client.SendAsync(mailMessage);
            }
            catch (Exception e)
            {
                //log an error message or throw an exception,or both.
                throw e;
            }
            finally
            {
                await client.disconnectAsync(true);
                client.dispose();
            }
        }
    }

enter image description here

from 应该是表单中的内容。 有人知道我错过了什么吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)