複数のファイルを電子メール アドレスに送信する必要があります。ファイルには .tcx ファイル拡張子が必要です。これらは実際には xml ファイル (Garmin 自転車ログ) です。
どうやら、受信者が電子メールを受け取ると、添付ファイルの名前は xxxxx.tcx.xml になっているようです。メーラーが添付ファイル名を変更しないようにするにはどうすればよいですか?
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);
}
}
}
}