質問編集履歴
1
ソースコードのインデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -68,162 +68,164 @@
|
|
68
68
|
|
69
69
|
{
|
70
70
|
|
71
|
-
public partial class feedback : Form
|
71
|
+
public partial class feedback : Form
|
72
|
-
|
72
|
+
|
73
|
-
{
|
73
|
+
{
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
-
string[] BadWord = { "**",
|
77
|
+
string[] BadWord = { "***","***","***" };
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
-
public feedback()
|
81
|
+
public feedback()
|
82
|
-
|
82
|
+
|
83
|
-
{
|
83
|
+
{
|
84
|
-
|
84
|
+
|
85
|
-
InitializeComponent();
|
85
|
+
InitializeComponent();
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
private void feedback_Load(object sender, EventArgs e)
|
92
|
+
|
93
|
+
{
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
private void OK_Click(object sender, EventArgs e)
|
102
|
+
|
103
|
+
{
|
104
|
+
|
105
|
+
ErrorProvider1.Clear();
|
106
|
+
|
107
|
+
if (MailAdress.Text == "")
|
108
|
+
|
109
|
+
{
|
110
|
+
|
111
|
+
MessageBox.Show("送信元のメールアドレスが入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
112
|
+
|
113
|
+
ErrorProvider1.SetError(MailAdress, "送信元のメールアドレスが入力されていません。");
|
114
|
+
|
115
|
+
goto MailSkip;
|
116
|
+
|
117
|
+
}
|
118
|
+
|
119
|
+
else if (MailTitle.Text == "")
|
120
|
+
|
121
|
+
{
|
122
|
+
|
123
|
+
MessageBox.Show("フィードバックのタイトルが入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
124
|
+
|
125
|
+
ErrorProvider1.SetError(MailTitle, "フィードバックのタイトルが入力されていません。");
|
126
|
+
|
127
|
+
goto MailSkip;
|
128
|
+
|
129
|
+
}
|
130
|
+
|
131
|
+
else if (Message.Text == "")
|
132
|
+
|
133
|
+
{
|
134
|
+
|
135
|
+
MessageBox.Show("フィードバックの内容が入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
136
|
+
|
137
|
+
goto MailSkip;
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
for (int i = 0; i < BadWord.Length; i++)
|
144
|
+
|
145
|
+
{
|
146
|
+
|
147
|
+
if (Message.Text.Contains(BadWord[i]) == true || MailTitle.Text.Contains(BadWord[i]) == true)
|
148
|
+
|
149
|
+
{
|
150
|
+
|
151
|
+
MessageBox.Show("フィードバックのタイトルまたは内容に不適切な表現が含まれています。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
152
|
+
|
153
|
+
goto MailSkip;
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
try
|
160
|
+
|
161
|
+
{
|
162
|
+
|
163
|
+
MailAddress ToMailAddress = new MailAddress(MailAdress.Text);
|
164
|
+
|
165
|
+
MailAddress FromMailAddress = new MailAddress("xxxxx@yahoo.co.jp");
|
166
|
+
|
167
|
+
MailMessage MailInfo = new MailMessage();
|
168
|
+
|
169
|
+
System.Net.NetworkCredential Certification = new System.Net.NetworkCredential("YahooID", "Password");
|
170
|
+
|
171
|
+
MailInfo.To.Add(ToMailAddress);
|
172
|
+
|
173
|
+
MailInfo.From = FromMailAddress;
|
174
|
+
|
175
|
+
MailInfo.Subject = MailTitle.Text;
|
176
|
+
|
177
|
+
MailInfo.Body = Message.Text;
|
178
|
+
|
179
|
+
MailInfo.BodyEncoding = System.Text.Encoding.GetEncoding("iso-2022-jp");
|
180
|
+
|
181
|
+
SmtpClient SMTP = new SmtpClient();
|
182
|
+
|
183
|
+
SMTP.Port = 587;
|
184
|
+
|
185
|
+
SMTP.DeliveryMethod = SmtpDeliveryMethod.Network;
|
186
|
+
|
187
|
+
SMTP.Host = "smtp.mail.yahoo.co.jp";
|
188
|
+
|
189
|
+
SMTP.Credentials = Certification;
|
190
|
+
|
191
|
+
SMTP.EnableSsl = false;
|
192
|
+
|
193
|
+
SMTP.Send(MailInfo);
|
194
|
+
|
195
|
+
MailInfo.Dispose();
|
196
|
+
|
197
|
+
SMTP.Dispose();
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
catch (Exception err)
|
202
|
+
|
203
|
+
{
|
204
|
+
|
205
|
+
MessageBox.Show("メールの送信に失敗しました。\n\n" + err, Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
MailSkip:;
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
private void Cansel_Click(object sender, EventArgs e)
|
216
|
+
|
217
|
+
{
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
}
|
86
224
|
|
87
225
|
}
|
88
226
|
|
89
227
|
|
90
228
|
|
91
|
-
private void feedback_Load(object sender, EventArgs e)
|
92
|
-
|
93
|
-
{
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
private void OK_Click(object sender, EventArgs e)
|
102
|
-
|
103
|
-
{
|
104
|
-
|
105
|
-
ErrorProvider1.Clear();
|
106
|
-
|
107
|
-
if (MailAdress.Text == "")
|
108
|
-
|
109
|
-
{
|
110
|
-
|
111
|
-
MessageBox.Show("送信元のメールアドレスが入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
112
|
-
|
113
|
-
ErrorProvider1.SetError(MailAdress, "送信元のメールアドレスが入力されていません。");
|
114
|
-
|
115
|
-
goto MailSkip;
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
else if (MailTitle.Text == "")
|
120
|
-
|
121
|
-
{
|
122
|
-
|
123
|
-
MessageBox.Show("フィードバックのタイトルが入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
124
|
-
|
125
|
-
ErrorProvider1.SetError(MailTitle, "フィードバックのタイトルが入力されていません。");
|
126
|
-
|
127
|
-
goto MailSkip;
|
128
|
-
|
129
|
-
}
|
130
|
-
|
131
|
-
else if (Message.Text == "")
|
132
|
-
|
133
|
-
{
|
134
|
-
|
135
|
-
MessageBox.Show("フィードバック内容が入力されていません。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
136
|
-
|
137
|
-
goto MailSkip;
|
138
|
-
|
139
|
-
}
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
for (int i = 0; i < BadWord.Length; i++)
|
144
|
-
|
145
|
-
{
|
146
|
-
|
147
|
-
if(Message.Text.Contains(BadWord[i]) == true || MailTitle.Text.Contains(BadWord[i]) == true)
|
148
|
-
|
149
|
-
{
|
150
|
-
|
151
|
-
MessageBox.Show("フィードバックのタイトルまたは内容に不適切な表現が含まれています。", Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
152
|
-
|
153
|
-
goto MailSkip;
|
154
|
-
|
155
|
-
}
|
156
|
-
|
157
|
-
}
|
158
|
-
|
159
|
-
try
|
160
|
-
|
161
|
-
{
|
162
|
-
|
163
|
-
MailAddress ToMailAddress = new MailAddress(MailAdress.Text);
|
164
|
-
|
165
|
-
MailAddress FromMailAddress = new MailAddress("Yahooのメアド");
|
166
|
-
|
167
|
-
MailMessage MailInfo = new MailMessage();
|
168
|
-
|
169
|
-
System.Net.NetworkCredential Certification = new System.Net.NetworkCredential("YahooID", "パスワード");
|
170
|
-
|
171
|
-
MailInfo.To.Add(ToMailAddress);
|
172
|
-
|
173
|
-
MailInfo.From = FromMailAddress;
|
174
|
-
|
175
|
-
MailInfo.Subject = MailTitle.Text;
|
176
|
-
|
177
|
-
MailInfo.Body = Message.Text;
|
178
|
-
|
179
|
-
MailInfo.BodyEncoding = System.Text.Encoding.GetEncoding("iso-2022-jp");
|
180
|
-
|
181
|
-
SmtpClient SMTP = new SmtpClient();
|
182
|
-
|
183
|
-
SMTP.Port = 587;
|
184
|
-
|
185
|
-
SMTP.DeliveryMethod = SmtpDeliveryMethod.Network;
|
186
|
-
|
187
|
-
SMTP.Host = "smtp.mail.yahoo.co.jp";
|
188
|
-
|
189
|
-
SMTP.Credentials = Certification;
|
190
|
-
|
191
|
-
SMTP.EnableSsl = false;
|
192
|
-
|
193
|
-
SMTP.Send(MailInfo);
|
194
|
-
|
195
|
-
MailInfo.Dispose();
|
196
|
-
|
197
|
-
SMTP.Dispose();
|
198
|
-
|
199
|
-
}
|
200
|
-
|
201
|
-
catch (Exception err)
|
202
|
-
|
203
|
-
{
|
204
|
-
|
205
|
-
MessageBox.Show("メールの送信に失敗しました。\n\n" + err, Form2.AppName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
206
|
-
|
207
|
-
}
|
208
|
-
|
209
|
-
MailSkip:;
|
210
|
-
|
211
|
-
}
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
private void Cansel_Click(object sender, EventArgs e)
|
216
|
-
|
217
|
-
{
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
}
|
222
|
-
|
223
|
-
}
|
224
|
-
|
225
|
-
}
|
226
|
-
|
227
229
|
```
|
228
230
|
|
229
231
|
|