私はASP.NETを初めて使用しますが、ご容赦ください。これが私がしたことです、
WEB.CONFIG
<system.net>
<mailSettings>
<smtp from="mygmail@gmail.com">
<network host="smtp.gmail.com" password="mygmailpwd"
userName="mygmail@gmail.com" enableSsl="true"/>
</smtp>
</mailSettings>
</system.net>
PASSWORDRECOVERYRES.ASPX
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="PasswordRecoveryRes.aspx.cs" Inherits="PasswordRecovery" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1> Forgot Your Password?</h1>
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server"
onsendingmail="PasswordRecovery1_SendingMail"
onsendmailerror="PasswordRecovery1_SendMailError"
onverifyinganswer="PasswordRecovery1_VerifyingAnswer"
onverifyinguser="PasswordRecovery1_VerifyingUser">
<MailDefinition From="mygmail@gmail.com" Subject="Password Recovery">
</MailDefinition>
</asp:PasswordRecovery>
</asp:Content>
PASSWORDRECOVERYRES.ASPX.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
public partial class PasswordRecovery : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
PasswordRecovery1.SuccessText = e.Message.Body;
e.Cancel = true;
}
protected void PasswordRecovery1_SendMailError(object sender, SendMailErrorEventArgs e)
{
}
protected void PasswordRecovery1_VerifyingAnswer(object sender, LoginCancelEventArgs e)
{
}
protected void PasswordRecovery1_VerifyingUser(object sender, LoginCancelEventArgs e)
{
}
}
PASSWORDRECOVERYRES.ASPX を実行したとき、エラーは発生しませんでした。次のメッセージが表示されます
"Please return to the site and log in using the following information. User Name: username1 Password: %#;IXWh3b:Zj$:"
しかし、このメッセージは mygmail@gmail.com から username1@gmail.com に電子メールで送信されるべきではありませんか? 私は何を間違っていますか?