これは私の問題です。私は私の電子メールアプリケーションが電子メールを送信して、私はそれがリッチテキストボックスにメッセージのステータスを書いている送信の最後に。ここに問題がある。 10個の電子メールを送信しているとします。リッチテキストボックスはすべての繰り返しで更新されません。 10個の電子メールがすべて送信されると、ボックスは送信されたメッセージで更新されます。 4つのループを通っている間、アプリケーションは凍結されているようです。リッチテキストボックスに書き込む。
for (int count = 0; count < numEmailToSend; count++)
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
if (typeSelectedItem == "text/html") { message.IsBodyHtml = true; }
if (typeSelectedItem == "text/plain") { message.IsBodyHtml = false; }
message.To.Add(emailAddress);
if (txtCC.Text != "")
{message.CC.Add(txtCC.Text);}
if (txtBCC.Text != "")
{message.Bcc.Add(txtBCC.Text);}
message.Subject = subject;
message.From = new System.Net.Mail.MailAddress(emailSender);
message.Body = body;
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(server);
rtbStatus.Text = rtbStatus.Text + "Starting to Send Message\r\n";
Thread.Sleep(avgDelay * 1000);
//smtp.Send(message);
smtp.SendAsync(message,1);
rtbStatus.Text = rtbStatus.Text + "Message Sent\r\n";
}
これはどのようにして動作しますか? – Andy12
どのように動作しますか? – SLaks