私の質問を見てくれてありがとう。
OpenNetCF.Net.Mailの添付ファイルを見つけようとしています。SendMail関数のコードは次のとおりです。
public static void SendMessage(string subject,
string messageBody,
string fromAddress,
string toAddress,
string ccAddress)
{
MailMessage message = new MailMessage();
SmtpClient client = new SmtpClient();
MailAddress address = new MailAddress(fromAddress);
// Set the sender's address
message.From = address;
// Allow multiple "To" addresses to be separated by a semi-colon
if (toAddress.Trim().Length > 0)
{
foreach (string addr in toAddress.Split(';'))
{
message.To.Add(new MailAddress(addr));
}
}
// Allow multiple "Cc" addresses to be separated by a semi-colon
if (ccAddress.Trim().Length > 0)
{
foreach (string addr in ccAddress.Split(';'))
{
message.CC.Add(new MailAddress(addr));
}
}
// Set the subject and message body text
message.Subject = subject;
message.Body = messageBody;
// TODO: *** Modify for your SMTP server ***
// Set the SMTP server to be used to send the message
client.Host = "smtp.dscarwash.com";
string domain = "dscarwash.com";
client.Credentials = new SmtpCredential("mailuser", "dscarwash10", domain);
// Send the e-mail message
try
{
client.Send(message);
}
catch (Exception e)
{
string data = e.ToString();
}
}
添付ファイルを許可するには、次のように調整する必要があります。
Attachment myAttachment = new Attachment();
message.Attachments.Add(myAttachment);
問題は、添付ファイルを追加する方法がわからないことです。上記の行は、実際に添付するファイルを指定する中央に何か他のものがあるはずです。この問題に関する助けをいただければ幸いです。
再度、感謝します!