我的代码是:
using System.Net.Mail;<br/>
using System.Net;<br/>
public partial class Index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void home_btn_Click(object sender, ImageClickEventArgs e)
{
MailMessage msg = new MailMessage();
msg.From = new MailAddress(home_mail.Text);
msg.To.Add(new MailAddress("ashwanirawat22@gmail.com"));
//msg.CC.Add ( new MailAddress(txtcc.Text));
//msg.Subject = txtSubject.Text;
msg.Body = home_msg.Text;
msg.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new System.Net.NetworkCredential(home_mail.Text,home_pass.Text);
label1.Visible = true;
smtp.EnableSsl = true;
try
{
smtp.Send(msg);
label1.Text = "Email Send";
}
catch
{
label1.Text = "Email Failed";
}
home_msg.Text = "";
home_mail.Text = "";
home_pass.Text = "";
}
}
html代码是:
Message: <asp:TextBox ID="home_msg" Rows="5" Columns="45" TextMode="MultiLine"runat="server">
</asp:TextBox><br/>
From: <asp:TextBox ID="home_mail" runat="server" Height="30px" Width="380px"></asp:TextBox></div><br />
Password:
<asp:TextBox ID="home_pass" runat="server" Height="30px" Width="380px" TextMode="Password"></asp:TextBox>
<asp:ImageButton ID="home_btn" ImageUrl="~/images/button.png" runat="server"
Height="30px" Width="75px" onclick="home_btn_Click" />
<asp:Label ID="label1" runat="server"></asp:Label>
现在我的问题是我的帐户中只收到了 gmail 帐户邮件,但我还没有收到其他帐户,如 hotmail、yahoo 等邮件。如何在我的帐户中接收所有帐户邮件????