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 7891217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:33:43+00:00 2026-06-03T06:33:43+00:00

I have to mail several files to an e-mail address. The files needs to

  • 0

I have to mail several files to an e-mail address. The files needs to have .tcx file extension. These are in fact xml files (Garmin bicycle logs).

Apparently when the receiver gets the email, the attachement is named xxxxx.tcx.xml. How can I force the mailer not to change the attachment file name?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.IO;

namespace stravamailer
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var files = Directory.GetFiles("E:\\JurgenS\\Downloads\\allrides");

            for (int i = 0; i < files.Length; i++)
            {
                MailMessage oMail = new MailMessage();
                oMail.Body = "";
                oMail.From = new MailAddress("jurgen@ccccc.be","Jurgen Stillaert");
                oMail.Subject = "";
                oMail.To.Add(new MailAddress("jurgen@cccc.be"));
                Attachment att = new Attachment(files[i]);
                att.Name = Path.GetFileName(files[i]);
                oMail.Attachments.Add(att);

                SmtpClient oSmtp = new SmtpClient("uit.telenet.be");
                oSmtp.Send(oMail);
            }
        }
    }
}
  • 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-06-03T06:33:44+00:00Added an answer on June 3, 2026 at 6:33 am

    The Attachment class is used with the MailMessage class. All messages
    include a Body, which contains the content of the message. In addition
    to the body, you might want to send additional files. These are sent
    as attachments and are represented as Attachment instances. To add an
    attachment to a mail message, add it to the MailMessage.Attachments
    collection.

    Attachment content can be a String, Stream, or file name. You can
    specify the content in an attachment by using any of the Attachment
    constructors.

    The MIME Content-Type header information for the attachment is
    represented by the ContentType property. The Content-Type header
    specifies the media type and subtype and any associated parameters.
    Use ContentType to get the instance associated with an attachment.

    The MIME Content-Disposition header is represented by the
    ContentDisposition property. The Content-Disposition header specifies
    the presentation and file time stamps for an attachment. A
    Content-Disposition header is sent only if the attachment is a file.
    Use the ContentDisposition property to get the instance associated
    with an attachment.

    The MIME Content-Transfer-Encoding header is represented by the
    TransferEncoding property.

    Here is the source

    Your solution is in this MSDN link. you should try MIME Content-Type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several sites in different domains: example.com , example.org , mail.example.com and passport.example.org
I have a e-mail address validator but I need to add special characters as
I have a textBox and I am using it as a mail address input
I have a Windows service that monitors several mailboxes for new mail. Once new
I have several PHP files to be run by cron. I set up the
I have an account table with a unique constraint on the e-mail address. My
I have mail server configuration data (server - user name - password - port)
I have this mail script I have to run a few times. To start
I have a mail webform where I have to show the user only (-1)
I have implemented mail composer. But it opens mail composer whenever user had implemented

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.