4

So im implementing a mailservice in our webapp that users can utilize to send out emails to persons on a certain list. Now i need to know how to best use the System.Net.Mail object to send mail on the users behalf. Ive been trying this now for a while without the right results.

I would like the mail to read "our system on behalf of user 1" and the reply to adress should be the adress that user1 has in our system so that when the contacted person wants to reply to the mail he should get user1:s address, not ours. How can I do this?

Which fields do I need to declare and how? This is how i have it set up right now, but a reply to these settings sends a mail back to noreply@oursystem.com

from = 'noreply@oursystem.com'
replyTo = 'user1@privateaddress.com'
to = 'user1@privateaddress.com'
sender  = 'user1@privateaddress.com'
cc  = ''
4

2 に答える 2

2

ReplyToobsoleteです。ReplyToListを使用する必要があります

例:

MailAddress mailFrom = new MailAddress("noreply@oursystem.com");
MailAddress mailTo = new MailAddress("user1@privateaddress.com");
MailAddress mailReplyTo = new MailAddress("user1@privateaddress.com");

MailMessage message = new MailMessage();
message.From = mailFrom;
message.To.Add(mailTo); //here you could add multiple recepients
message.ReplyToList.Add(mailReplyTo); //here you could add multiple replyTo adresses
于 2013-02-27T07:37:43.180 に答える
0

これは、受信側のプログラミング エラーが原因でした。正しい解決策は、上記のように from と replyto を設定することです。これにより、正しい動作が得られます。

于 2013-02-27T07:40:29.150 に答える