Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6386773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:04:06+00:00 2026-05-25T03:04:06+00:00

Using C#, .net 4.0 I’m using HttpUtility.ParseQueryString to parse a mailto URI, as such:

  • 0

Using C#, .net 4.0

I’m using HttpUtility.ParseQueryString to parse a mailto URI, as such:

MailMessage message = new MailMessage();
NameValueCollection mailTo = System.Web.HttpUtility.ParseQueryString(mailToUri.OriginalString.Split('?')[1]);
message.Subject = mailTo["subject"];

The URI can have multiple “to” parameters, such as:

mailto://?to=address1@email.com&to=address2@email.com&to=address3@email.com&subject=test&body=this%20should%20be%20the%20body"

When stepping through the code I can see ParseQueryString creates the mailTo[“to”] NameValueCollection that contains a single “to” key with multiple values, which appears to be an object of type System.Collections.Specialized.NameObjectCollectionBase.NameObjectEntry

I’m sure I’m missing something simple. I haven’t been able to figure out how to iterate over this collection and get each individual value. I’d be looking for something like this, which obviously doesn’t work:

        foreach (String address in mailTo["to"])
        {
            message.To.Add(new MailAddress(address));
        }

Additionally, if you know a better way to go from mailto URI to SMTP message I’m all eyes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:04:06+00:00Added an answer on May 25, 2026 at 3:04 am

    the value part of the NameValueCollection is a string. So for the “to” key it would be a comma delimited string of email addresses.

    string s = "to=address1@email.com&to=address2@email.com&to=address3@email.com&subject=test";
    var items = System.Web.HttpUtility.ParseQueryString(s);
    
    foreach(string email in items["to"].Split(','))
    {
        Console.Out.WriteLine(email);
    }
    

    results in the following

    address1@email.com
    address2@email.com
    address3@email.com
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using .net 2.0 and I've created a form (System.Windows.Forms.Form) for displaying information during
I have implement a small web service using .net 3.5. I have used linq
Using .Net (C#), how can you work with USB devices? How can you detect
Using .NET 1.1, I have a DataGrid that contains three columns for each row.
Using .Net 3.0 and VS2005. The objects in question are consumed from a WCF
NOTE: Using .NET 2.0, and VS2005 as IDE Hello all, I'm working on logging
I am using .NET remoting to retrieve periodic status updates from a Windows service
I am using .NET Remoting. My server/hoster is a Windows Service. It will sometimes
I'm using .NET 3.5. I have two string arrays, which may share one or
I am using .Net 2 and the normal way to store my settings. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.