邮件地址是: 
[email protected] 
这样形式,公司域名是与gmail邮件绑定的。 程序中发送一直不行。 提示错误: 
[System.Net.Mail.SmtpException] = {"SMTP 服务器要求安全连接或客户端未通过身份验证。 服务器响应为: 5.5.1 Authentication Required.
请教各位大侠如何解决!

解决方案 »

  1.   


            string emailname = "*****@lanstarnet.com";
            string emailpassword = "*****";
            System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.gmail.com");
            client.Port = 587;
            client.EnableSsl = true ;
            client.Credentials = new System.Net.NetworkCredential(emailname, emailpassword);        System.Net.Mail.MailMessage message = new MailMessage(addressFrom, addressTo);        message.Subject = "Hello";
            message.Body = "Hello";        message.BodyEncoding = System.Text.Encoding.UTF8;
            message.IsBodyHtml = true;client.Send(message);主要代码如上,实在想不出哪儿出错了。
      

  2.   

    System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("mail.gmail.com");
    改一下再试试。
      

  3.   

    参考下别人的解决办法吧...
    http://www.cnblogs.com/DonLiang/archive/2009/01/17/1071236.html
      

  4.   

    我们公司也是Gmail提供的服务,给楼主个代码,我现在用的:/// <summary>
            /// 使用Gmail邮箱发送邮件
            /// </summary>
            /// <param name="addressFrom">发件人地址</param>
            /// <param name="recipients">收件人地址</param>
            /// <param name="userID">用户名。如:[email protected]用户名为temp;[email protected]用户名则为[email protected]</param>
            /// <param name="userPassword">密码</param>
            /// <param name="subject">主题</param>
            /// <param name="body">内容</param>
            private static void SendEmailFromBeijingply(string addressFrom, string recipients, string userID, string userPassword, string subject, string body)
            {
                SmtpClient mailClient = new SmtpClient("smtp.gmail.com", 587);
                mailClient.EnableSsl = true;
                System.Net.NetworkCredential crendetial = new NetworkCredential(userID, userPassword);
                mailClient.Credentials = crendetial;
                MailMessage message = new MailMessage(addressFrom, recipients, subject, body);
                message.IsBodyHtml = true;
                mailClient.Send(message);
            }
      

  5.   

    在邮件账号的POP设置里对从现在起所收到的邮件启用 POP 启用一下。这个你试过了么?
      

  6.   

    我的电脑 右键 管理 - 
    服务和应用程序 - 
    IIS信息服务 -
    默认SMTP虚拟服务 右键 属性  访问 中继限制 选择仅下列表除外。再试试这个。