質問編集履歴
1
ソースコードのインデント
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,84 +33,85 @@
|
|
33
33
|
|
34
34
|
namespace WindowsFormsApp18
|
35
35
|
{
|
36
|
-
public partial class feedback : Form
|
36
|
+
public partial class feedback : Form
|
37
|
-
{
|
37
|
+
{
|
38
38
|
|
39
|
-
string[] BadWord = { "**
|
39
|
+
string[] BadWord = { "***","***","***" };
|
40
40
|
|
41
|
-
public feedback()
|
41
|
+
public feedback()
|
42
|
-
{
|
42
|
+
{
|
43
|
-
InitializeComponent();
|
43
|
+
InitializeComponent();
|
44
|
-
}
|
44
|
+
}
|
45
45
|
|
46
|
-
private void feedback_Load(object sender, EventArgs e)
|
46
|
+
private void feedback_Load(object sender, EventArgs e)
|
47
|
-
{
|
47
|
+
{
|
48
48
|
|
49
|
-
}
|
49
|
+
}
|
50
50
|
|
51
|
-
private void OK_Click(object sender, EventArgs e)
|
51
|
+
private void OK_Click(object sender, EventArgs e)
|
52
|
-
{
|
52
|
+
{
|
53
|
-
ErrorProvider1.Clear();
|
53
|
+
ErrorProvider1.Clear();
|
54
|
-
if (MailAdress.Text == "")
|
54
|
+
if (MailAdress.Text == "")
|
55
|
-
{
|
55
|
+
{
|
56
|
-
MessageBox.Show("送信元のメールアドレスが入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
56
|
+
MessageBox.Show("送信元のメールアドレスが入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
57
|
-
ErrorProvider1.SetError(MailAdress, "送信元のメールアドレスが入力されていません。");
|
57
|
+
ErrorProvider1.SetError(MailAdress, "送信元のメールアドレスが入力されていません。");
|
58
|
-
goto MailSkip;
|
58
|
+
goto MailSkip;
|
59
|
-
}
|
59
|
+
}
|
60
|
-
else if (MailTitle.Text == "")
|
60
|
+
else if (MailTitle.Text == "")
|
61
|
-
{
|
61
|
+
{
|
62
|
-
MessageBox.Show("フィードバックのタイトルが入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
62
|
+
MessageBox.Show("フィードバックのタイトルが入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
63
|
-
ErrorProvider1.SetError(MailTitle, "フィードバックのタイトルが入力されていません。");
|
63
|
+
ErrorProvider1.SetError(MailTitle, "フィードバックのタイトルが入力されていません。");
|
64
|
-
goto MailSkip;
|
64
|
+
goto MailSkip;
|
65
|
-
}
|
65
|
+
}
|
66
|
-
else if (Message.Text == "")
|
66
|
+
else if (Message.Text == "")
|
67
|
-
{
|
67
|
+
{
|
68
|
-
MessageBox.Show("フィードバック内容が入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
68
|
+
MessageBox.Show("フィードバックの内容が入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
69
|
-
goto MailSkip;
|
69
|
+
goto MailSkip;
|
70
|
-
}
|
70
|
+
}
|
71
71
|
|
72
|
-
for (int i = 0; i < BadWord.Length; i++)
|
72
|
+
for (int i = 0; i < BadWord.Length; i++)
|
73
|
-
{
|
73
|
+
{
|
74
|
-
if(Message.Text.Contains(BadWord[i]) == true || MailTitle.Text.Contains(BadWord[i]) == true)
|
74
|
+
if (Message.Text.Contains(BadWord[i]) == true || MailTitle.Text.Contains(BadWord[i]) == true)
|
75
|
-
{
|
75
|
+
{
|
76
|
-
MessageBox.Show("フィードバックのタイトルまたは内容に不適切な表現が含まれています。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
76
|
+
MessageBox.Show("フィードバックのタイトルまたは内容に不適切な表現が含まれています。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
77
|
-
goto MailSkip;
|
77
|
+
goto MailSkip;
|
78
|
-
}
|
78
|
+
}
|
79
|
-
}
|
79
|
+
}
|
80
|
-
try
|
80
|
+
try
|
81
|
-
{
|
81
|
+
{
|
82
|
-
MailAddress ToMailAddress = new MailAddress(MailAdress.Text);
|
82
|
+
MailAddress ToMailAddress = new MailAddress(MailAdress.Text);
|
83
|
-
MailAddress FromMailAddress = new MailAddress("
|
83
|
+
MailAddress FromMailAddress = new MailAddress("xxxxx@yahoo.co.jp");
|
84
|
-
MailMessage MailInfo = new MailMessage();
|
84
|
+
MailMessage MailInfo = new MailMessage();
|
85
|
-
System.Net.NetworkCredential Certification = new System.Net.NetworkCredential("YahooID", "
|
85
|
+
System.Net.NetworkCredential Certification = new System.Net.NetworkCredential("YahooID", "Password");
|
86
|
-
MailInfo.To.Add(ToMailAddress);
|
86
|
+
MailInfo.To.Add(ToMailAddress);
|
87
|
-
MailInfo.From = FromMailAddress;
|
87
|
+
MailInfo.From = FromMailAddress;
|
88
|
-
MailInfo.Subject = MailTitle.Text;
|
88
|
+
MailInfo.Subject = MailTitle.Text;
|
89
|
-
MailInfo.Body = Message.Text;
|
89
|
+
MailInfo.Body = Message.Text;
|
90
|
-
MailInfo.BodyEncoding = System.Text.Encoding.GetEncoding("iso-2022-jp");
|
90
|
+
MailInfo.BodyEncoding = System.Text.Encoding.GetEncoding("iso-2022-jp");
|
91
|
-
SmtpClient SMTP = new SmtpClient();
|
91
|
+
SmtpClient SMTP = new SmtpClient();
|
92
|
-
SMTP.Port = 587;
|
92
|
+
SMTP.Port = 587;
|
93
|
-
SMTP.DeliveryMethod = SmtpDeliveryMethod.Network;
|
93
|
+
SMTP.DeliveryMethod = SmtpDeliveryMethod.Network;
|
94
|
-
SMTP.Host = "smtp.mail.yahoo.co.jp";
|
94
|
+
SMTP.Host = "smtp.mail.yahoo.co.jp";
|
95
|
-
SMTP.Credentials = Certification;
|
95
|
+
SMTP.Credentials = Certification;
|
96
|
-
SMTP.EnableSsl = false;
|
96
|
+
SMTP.EnableSsl = false;
|
97
|
-
SMTP.Send(MailInfo);
|
97
|
+
SMTP.Send(MailInfo);
|
98
|
-
MailInfo.Dispose();
|
98
|
+
MailInfo.Dispose();
|
99
|
-
SMTP.Dispose();
|
99
|
+
SMTP.Dispose();
|
100
|
-
}
|
100
|
+
}
|
101
|
-
catch (Exception err)
|
101
|
+
catch (Exception err)
|
102
|
-
{
|
102
|
+
{
|
103
|
-
MessageBox.Show("メールの送信に失敗しました。\n\n" + err, Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
103
|
+
MessageBox.Show("メールの送信に失敗しました。\n\n" + err, Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
104
|
-
}
|
104
|
+
}
|
105
|
-
MailSkip:;
|
105
|
+
MailSkip:;
|
106
|
-
}
|
106
|
+
}
|
107
107
|
|
108
|
-
private void Cansel_Click(object sender, EventArgs e)
|
108
|
+
private void Cansel_Click(object sender, EventArgs e)
|
109
|
-
{
|
109
|
+
{
|
110
110
|
|
111
|
+
}
|
112
|
+
}
|
111
113
|
}
|
112
|
-
|
114
|
+
|
113
|
-
}
|
114
115
|
```
|
115
116
|
|
116
117
|
### 試したこと
|