问题描述
我已使用以下代码使用 gmail 帐户从我的 Web 应用程序发送邮件.我的问题是,我可以将发件人地址更改为原始发件人(gmail)地址以外的其他地址吗?我的代码如下:
I have used the following code to send mail from my web application using a gmail account. My question is, can i change the sender address to another address other than original sender(gmail) address? My code is as follows:
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("sample@gmail.com", "*******");
无论我做什么都是无用的,因为我总是收到来自 sample@gmail.com 的邮件.可以改吗?
Whatever i do is useless as i always receive mail from sample@gmail.com. Is it possible to change it?
我已经改成mail.From = new System.Net.Mail.MailAddress("sample@yahoo.com"); 但我收到了来自地址 sample@gmail.com 的邮件而不是来自新的发件人"地址.我认为 gmail smtp 会用原始凭据覆盖发件人地址.
I have changed to
mail.From = new System.Net.Mail.MailAddress("sample@yahoo.com"); but i received the mail with the from address sample@gmail.com and not from the new "From" address. I think gmail smtp overwrites the from address with the original credential.
推荐答案
Gmail 不允许您将 FROM 更改为不同于您的 gmail 帐户的内容.
Gmail doesn't allow you to change the FROM to something different than your gmail account.
无论您使用什么,他们都会在转发之前覆盖它.这可以防止垃圾邮件/欺骗.
It doesn't matter what you use, they over-write it, before they relay it on. This prevent spamming/spoofing.
这篇关于在c#中通过gmail发送邮件时更改发件人地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)