通过Gmail在C#中发送邮件时更改发件人地址 [英] change sender address when sending mail through gmail in c#

查看:650
本文介绍了通过Gmail在C#中发送邮件时更改发件人地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用下面的code从使用Gmail帐户我的web应用程序发送邮件..我可以更改发件人地址到另一个地址以外的原始发件人(Gmail地址)。

I ve used the following code to send mail from my web application using a gmail account.. Can i change the sender address to another address other than original sender(gmail) address..

 System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();


System.Net.NetworkCredential cred = new 
       System.Net.NetworkCredential("sample@gmail.com", "*******");

我总是收到来自 sample@gmail.com 邮件。是否有可能改变呢?

I always receive mail from sample@gmail.com. Is it possible to change it?

我已经改变
     mail.From =新System.Net.Mail.MailAddress(sample@yahoo.com); ,但我收到邮件的发件人地址 sample@gmail.com ,而不是从地址新。我认为Gmail的SMTP与原始凭证将覆盖从地址...

I ve 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 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.

这不要紧,你用什么,他们在写,他们传递它之前。这prevent垃圾邮件/欺骗。

It doesn't matter what you use, they over-write it, before they relay it on. This prevent spamming/spoofing.

这篇关于通过Gmail在C#中发送邮件时更改发件人地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆