private void menuSendMail_Click(object sender, EventArgs e)
{
string size = "";
string priority = "";
// アドレスまたは本文が未入力のとき
if (textAddress.Text == "" || textBody.Text == "") {
if (textAddress.Text == "") {
// アドレス未入力エラーメッセージを表示する
MessageBox.Show("宛先が入力されていません。", "直接送信", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (textBody.Text == "") {
// 本文未入力エラーメッセージを表示する
MessageBox.Show("本文が入力されていません。", "直接送信", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return;
}
// 件名がないときは件名に(無題)を設定する
if (textSubject.Text == "") {
textSubject.Text = "(無題)";
}
// 優先度の設定をする
priority = mailPriority[comboPriority.Text];
// 文面の末尾が\r\nでないときは\r\nを付加する
if (!textBody.Text.EndsWith("\r\n")) {
textBody.Text += "\r\n";
}
CleanAttach();
attachName = GetAttaches();
// 送信メールサイズを取得する
size = GetMailSize();
// 直接送信
MainForm.DirectSendMail(this.textAddress.Text, this.textCc.Text, this.textBcc.Text, this.textSubject.Text, this.textBody.Text, attachName, priority);
string date = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString();
var sendMail = new Mail(this.textAddress.Text, "", this.textSubject.Text, this.textBody.Text, this.attachName, date, size, "", false, "", this.textCc.Text, this.textBcc.Text, priority);
// コレクションに追加する
SendList.Add(sendMail);
BeforeClosing(MainForm);
this.Close();
}