显示不同的“来自电子邮件”发送电子邮件 [英] Show different "from email" on sending email
问题描述
我有办公室365电子邮件地址,在向客户发送电子邮件时用作发件人电子邮件。
现在当电子邮件通知发送到他们的邮箱时,他们认为发件人地址应该是动态的。我曾尝试更改邮件消息对象的from属性,但是当收到电子邮件地址不是我设置的那个。它总是显示用于发送电子邮件的smtp电子邮件。
我尝试使用gmail smtp邮件,但没有获得成功。
似乎红宝石或珍珠支持了这一点。但我从来没有见过C#。是否可以使用C#?
我尝试过:
尝试使用不同的smtp服务器和网络凭据但无法更改来自电子邮件地址。
Hi,
I have an office 365 email address which is being used as sender email when sending email to clients.
Now there is an requirement when email notification goes to their mailbox they are looking that the from address should be dynamic. I had tried to change the from attribute of mail message object but when email received the from address is not the one which i had set. It always shows the smtp email that is being used to send emails.
I tried with gmail smtp mail as well but not get success on it.
It seems that ruby or pearl have supported this. But i had never seen it with C#. Is it possible with C#?
What I have tried:
Tried with different smtp server and network credentials but unable to change the from email address.
推荐答案
出于安全原因,今天的大多数电子邮件服务器都不允许您这样做。
Most email servers today will not allow you to do this for security reasons.
它没有很好的文档记录,但您可以使用Sender
属性:来自地址与发件人 [ ^ ]
将message.Sender
设置为您的Office365地址,并且message.From
到动态地址。
在Outlook中,这通常显示为 From < sender>代表< from address> 。其他邮件客户端可能会有所不同。
回复应自动发送到来自
地址而不是发件人
。但是传递状态通知仍然应该转到发件人
。
It's not very well documented, but you might be able to use theSender
property: From Address vs Sender[^]
Setmessage.Sender
to your Office365 address, andmessage.From
to the dynamic address.
In Outlook, this will typically be shown as "From <sender> on behalf of <from address>". Other mail clients might vary.
Replies should automatically be sent to theFrom
address rather than theSender
. But delivery status notifications should still go to theSender
.
这篇关于显示不同的“来自电子邮件”发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!