title: .NET SMTP Mail - Attachment File Name being renamed
body: <p><strong>Desired Approach:</strong></p>
  
  <p>I want to keep the same file name when sending the file as an attachment and not have .NET rename it (for whatever reason it's adding on the path to the file). <strong>I do not want to have to pass another param to set the file name.</strong></p>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>- Project (folder)
   - Content (folder)
    - Files (folder)
     - PDF (folder)
      - Triumeq (folder)
       - sample.pdf (file)
  </code></pre>
  
  <p>The file name in the attachment on the email is always renamed to:</p>
  
  <p><code>DOMAINcontentfilespdftriumeqsample.pdf</code> </p>
  
  <p>DOMAIN = marked out in image</p>
  
  <p><a href="https://i.stack.imgur.com/iXs2O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iXs2O.png" alt="enter image description here"></a></p>
  
  <p><strong>Things I've tried:</strong></p>
  
  <pre><code>// add attachment if applicable
  if (!string.IsNullOrEmpty(attachmentFilePath))
  {
      var fs = new FileStream(string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, attachmentFilePath), FileMode.Open, FileAccess.Read);
      msg.Attachments.Add(new Attachment(fs, fs.Name, MimeTypesHelper.GetContentType(Path.GetExtension(fs.Name))));
  
     // MimeTypeHelper.GetContentType just returns the MimeType of the file listed in the file stream
  }
  </code></pre>
  
  <p><strong>OR</strong></p>
  
  <pre><code>if (!string.IsNullOrEmpty(attachmentFilePath))
  {
      msg.Attachments.Add(new Attachment(string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, attachmentFilePath)));
  }
  </code></pre>
  
  <p>Each way always renames the file, and doesn't keep the original file name</p>