上面的问题解决了,只要定义名称空间
uing System.Web.Mail;就可以了,现在遇到新的问题代码如下MailMessage mail;
mail=new MailMessage();
mail.To=TextBox1.Text;
mail.From=TextBox2.Text;
mail.Subject=TextBox3.Text; if (mail.To != "")
{
SmtpMail.Send(mail);
TextBox3.Text="成功"; }
else
TextBox3.Text="失败";提示错误?
Server Error in '/Pdms_cs' Application.
--------------------------------------------------------------------------------“SendUsing”配置值无效。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: “SendUsing”配置值无效。 Source Error:
Line 61: if (mail.To != "")
Line 62: {
Line 63: SmtpMail.Send(mail);
Line 64:
Line 65: TextBox3.Text="成功";
uing System.Web.Mail;就可以了,现在遇到新的问题代码如下MailMessage mail;
mail=new MailMessage();
mail.To=TextBox1.Text;
mail.From=TextBox2.Text;
mail.Subject=TextBox3.Text; if (mail.To != "")
{
SmtpMail.Send(mail);
TextBox3.Text="成功"; }
else
TextBox3.Text="失败";提示错误?
Server Error in '/Pdms_cs' Application.
--------------------------------------------------------------------------------“SendUsing”配置值无效。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: “SendUsing”配置值无效。 Source Error:
Line 61: if (mail.To != "")
Line 62: {
Line 63: SmtpMail.Send(mail);
Line 64:
Line 65: TextBox3.Text="成功";
Mail.SmtpServer = "smtp.21cn.com";//设置服务器
SmtpMail smtp = new SmtpMail();
smtp.SmtpServer="122.18.100.20";可是 smtp 没有 SmtpServer这个属性? 提示错误
SmtpMail.SmtpServer="122.18.100.20";SmtpMail.send(mail);