如何发送电子邮件与用户的电子邮件

如何发送电子邮件与用户的电子邮件

本文介绍了如何发送电子邮件与用户的电子邮件,联系我们的页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个联系我们的页面,我想从这个页面收到邮件,因为邮件来自用户邮件。

I am creating a contact us page, and i want to receive mails from this page as its a mail came from the user mail.

我写了这段代码:

var client = new SmtpClient("smtp.gmail.com", 587)
                {
                    Credentials = new NetworkCredential("[email protected]", "password"),
                    EnableSsl = true
                };
                MailMessage mail = new MailMessage();
                mail.From = new MailAddress("[email protected]");
                mail.To.Add(new MailAddress("[email protected]"));
                mail.Body = "bodyTest";
                mail.Subject = "subjectTest";
                client.Send(mail);

但是我收到邮件不是用户的邮件

But i receive the mail from my mail not the user

如何做?

推荐答案

使用gmail,消息将来自用户登录,而不是用户在从。你可以把任何你想要的东西,但它不会按照你所期望的方式工作。

Using gmail, the message will come from the user logging in, not the user in the "from". You can put whatever you'd like in the from, but it doesn't work the way you'd expect.

使用一个小而免费的Google Apps帐户,我实际上设置了一个[email protected]帐户。我使用该帐户登录gmail,所以至少联系邮件就是这样。

Using a small, free Google Apps account, I've actually set up a '[email protected]' account. I log into gmail with that account, so at least contact mail has that as the from.

这篇关于如何发送电子邮件与用户的电子邮件,联系我们的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 01:51