イム、(今のところそのローカルホスト)私のウェブサイトのメールフォームをしようとして 私は私のコードを実行するとし、「送信」を押し、そのは私にこの例外をスロー:メールフォーム例外を送信する:System.Runtime.InteropServices.COMException:??? ?????? "SendUsing" ???? ?÷?
にSystem.Runtime .InteropServices.COMException:??? ?????? "SendUsing" ???? ?÷?
何が問題なのですか?
これは私のコードです:あなたが送信しようとする前に
<%@ Import Namespace="System.Web.Mail" %>
<script language="c#" runat="server">
protected void Button2_Click(object sender, EventArgs e)
{
MailMessage msg = new MailMessage();
msg.To = "[email protected]";
msg.From = EmailTxt.Text;
msg.Subject = "Fun With Daniel Email: from" + UsernameTxt.Text;
msg.Body = MessegeBox.Text;
msg.BodyFormat = MailFormat.Text;
ErrorMessege.Text = "Sending..";
System.Web.Mail.SmtpMail.Send(msg);
ErrorMessege.Text = "The Email Sent successfully!";
}
</script>
<td>
<asp:TextBox ID="UsernameTxt" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ErrorMessage="Please insert a Username"
ControlToValidate="UsernameTxt" ForeColor="Red" Display="None"
SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Email
</td>
<td>
<asp:TextBox ID="EmailTxt" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ErrorMessage="Please insert Password"
ControlToValidate="EmailTxt" ForeColor="Red" Display="None"
SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Messege
</td>
<td>
<asp:TextBox ID="MessegeBox" runat="server" Height="100px" TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="You have to write a messege"
ControlToValidate="MessegeBox" ForeColor="Red" Display="None"
SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button2" runat="server" Text="Login" OnClick="Button2_Click" />
</td>
<td>
<asp:Label ID="ErrorMessege" runat="server" ForeColor="Red"></asp:Label>
<asp:ValidationSummary ID="ValidationSummary2" runat="server" ForeColor="Red" />
</td>
</tr>
System.Web.Mail.SmtpMailは廃止されているため、System.Net.Mailクラスを使用することをお勧めします。 [もっと見る](http://msdn.microsoft.com/en-us/library/zx6wtd80.aspx) –