Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MailMessage.ReplyToList is ignored while the deprecated ReplyTo property does work #26

Open
frankvaneykelen opened this issue Aug 7, 2015 · 3 comments

Comments

@frankvaneykelen
Copy link

When I send a MailMessage that has a ReplyTo set I get what I expect:
"Reply-To: TentantName [email protected]" in the raw source of the message:

When I send a MailMessage that has the same To, but added to the ReplyToList, there's no Reply-To in the raw source of the message.

I think that this code in SystemMailExtensions.cs:

if (message.ReplyTo != null)
{
    pm.ReplyTo = !string.IsNullOrEmpty(message.ReplyTo.DisplayName)
        ? string.Format("{0} <{1}>", message.ReplyTo.DisplayName, message.ReplyTo.Address)
        : message.ReplyTo.Address;
}

should be extended to support a ReplyToList, also because ReplyTo is deprecated:

ReplyTo is obsoleted for this type. Please use ReplyToList instead which can accept multiple addresses.
https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.replyto(v=vs.110).aspx

@atheken
Copy link
Contributor

atheken commented Aug 10, 2015

The Postmark API currently supports only a single ReplyTo address, and therefore setting a list of reply-to addresses would not be honored by the API.

We could handle ReplyToList, but assert that it only has zero or one address in it, let me give this some thought and reply back later.

If you have an opinion about how you'd like to see this handled, knowing that we support a single ReplyTo, I'd love to get your feedback.

@frankvaneykelen
Copy link
Author

I think that handling a ReplyToList while ignoring all but the first address is something that developers would expect. Developers could be warned of it in the wiki (https://github.com/wildbit/postmark-dotnet/wiki/Using-System.Net.Mail.MailMessage):

There are two ways to specify a ReplyTo address:

mailMessage.ReplyTo = new MailAddress("[email protected]", "Some User");

mailMessage.ReplyToList.Add(new MailAddress("[email protected]", "Some User"));

If you use the first method please be aware that because it is deprecated ("ReplyTo is obsoleted for this type. Please use ReplyToList instead which can accept multiple addresses.") you might have to disable the warning:

#pragma warning disable 612, 618
    mailMessage.ReplyTo = new MailAddress("[email protected]", "Some User");
#pragma warning restore 612, 618

If you use the second method please be aware that only the first address in the ReplyToList will be used because the Postmark API only supports a single ReplyTo address !

@emaborsa
Copy link

emaborsa commented Dec 1, 2022

7 years and still open?

I have the same problem, ReplyToList is ignored, I use:

     msg.ReplyToList.Add(new MailAddress("[email protected]"));

but when I answer to the received email in outlook, the recipient is the sender and not this no-reply address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants