try
{
MailMessage Message = new MailMessage();
Message.To =E_mail1.Value; //发送到
Message.From = "[email protected]"; //本地邮箱
Message.Subject = "你的朋友"+user.Value+"给您的推荐站点"; //邮件主题
Message.Body =" 。。";
                                Message.Body+=content.Value; //邮件内容;

                                Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); 
                                Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "jj"); 
                                Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "*****"); 
SmtpMail.SmtpServer = "smtp.163.com";
SmtpMail.Send(Message);
Response.Write("<script>alert('发送成功!')</"+"script>");
}
catch (Exception ee)
                            {
Response.Write("<script>alert('发送失败!')</"+"script>");                             }
}用上面代码可以发送成功,但想改为sina 的企业邮箱却不可以了。怎么办。sina 的 Stmp 是:
SmtpMail.SmtpServer = "smtp.sina.net";
急啊,今天要完成的啊。

解决方案 »

  1.   

    新浪的smtp是:smtp.sina.net吗?你查查看。
    我不上新浪,所以帮不了你。
      

  2.   

    新浪的smtp是smtp.sina.com.cn,你再试试
      

  3.   

    Message.From = "[email protected]"; //本地邮箱  如/cdo/configuration/smtpauthenticate", "1"); 
                                    Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "web"); 
                                    Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "×××××"); 
    SmtpMail.SmtpServer = "smtp.sina.com.cn";//smtp.sina.net   ,smtp.sina.com  都不行啊,怎么办啊。
      

  4.   

    极有可能是sina smtp服务器禁止的原因
    catch (Exception ee)
                                {
    Response.Write("<script>alert('发送失败!"+ee.ToString()+"')</script>");看看是什么错误就可以了
      

  5.   

    发送邮件失败:System.Web.HttpException: 未能访问“CDO.Message”对象。 ---> System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.Runtime.InteropServices.COMException (0x80040211): 邮件无法发送到 SMTP 服务器。传输错误代码为 0x80040217。服务器响应为 not available --- 内部异常堆栈跟踪的结尾 --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) --- 内部异常堆栈跟踪的结尾 --- at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at plane.friend.btnOk_onClick(Object sender, EventArgs e)
      

  6.   

    可能是因为smtp服务器设置错误的原因。换成smtp.sina.com.cn或者mail.sina.com.cn试试看。我用的是免费信箱,可以实现。不过不知道企业邮箱是不是不同。
      

  7.   

    用jmail吧,很好用的,还支持身份验证
      

  8.   

    新浪的用户名和邮箱的名称有时候是不一样的.就是SMTP要求身份验证的用户名称和密码不对.