SmtpClient smtpClient = new SmtpClient(ConfigurationManager.AppSettings["mail"]);//配置邮件服务器
邮件服务器是公司内的服务器,现在程序已经可以发送到公司的内部油箱,
现在想让它可以发送邮件到内部和外部的油箱,请问怎么做?

解决方案 »

  1.   

    那 要办理 企业油箱服务的    outlook的?
      

  2.   

    MailMessage mail = new MailMessage();
    mail.From = "[email protected]";
    mail.To = mailTo;
    mail.Subject = mailSubject;
    mail.Body = mailMessage;
    mail.BodyEncoding = Encoding.Default;
    mail.BodyFormat = MailFormat.Html;
    mail.Priority = MailPriority.High; mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication 
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "temp"); //set your username here 
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "temp"); //set your password here 
    SmtpMail.SmtpServer = "mail.xxx.com.cn"; //your real server goes here  //SmtpMail.Send( mail );
      

  3.   

    很多企业局域网内都架设了邮件服务器,用于进行公文发送和工作交流。但使用专业的企业邮件系统软件需要大量的资金投入,这对于很多企业来说是无法承受的。其实我们可以通过Windows Server 2003提供的POP3服务和SMTP服务架设小型邮件服务器来满足我们的需要。  一、安装POP3和SMTP服务组件  Windows Server 2003默认情况下是没有安装POP3和SMTP服务组件的,因此我们要手工添加。  1.安装POP3服务组件  以系统管理员身份登录Windows Server 2003 系统。依次进入“控制面板→添加或删除程序→添加/删除Windows组件”,在弹出的“Windows组件向导”对话框中选中“电子邮件服务”选项,点击“详细信息”按钮,可以看到该选项包括两部分内容:POP3服务和POP3服务Web管理。为方便用户远程Web方式管理邮件服务器,建议选中“POP3服务Web管理”。  2.安装SMTP服务组件  选中“应用程序服务器”选项,点击“详细信息”按钮,接着在“Internet信息服务(IIS)”选项中查看详细信息,选中“SMTP Service”选项,最后点击“确定”按钮。此外,如果用户需要对邮件服务器进行远程Web管理,一定要选中“万维网服务”中的“远程管理(HTML)”组件。完成以上设置后,点击“下一步”按钮,系统就开始安装配置POP3和SMTP服务了。  二、配置POP3服务器  1.创建邮件域  点击“开始→管理工具→POP3服务”,弹出POP3服务控制台窗口。选中左栏中的POP3服务后,点击右栏中的“新域”,弹出“添加域”对话框,接着在“域名”栏中输入邮件服务器的域名,也就是邮件地址“@”后面的部分,如“rtj.net”,最后点击“确定”按钮。其中“rtj.net”为在Internet上注册的域名,并且该域名在DNS服务器中设置了MX邮件交换记录,解析到Windows Server 2003邮件服务器IP地址上。  2.创建用户邮箱  选中刚才新建的“rtj.net”域,在右栏中点击“添加邮箱”,弹出添加邮箱对话框,在“邮箱名”栏中输入邮件用户名,然后设置用户密码,最后点击“确定”按钮,完成邮箱的创建。  三、配置SMTP服务器  完成POP3服务器的配置后,就可开始配置SMTP服务器了。点击“开始→程序→管理工具→Internet信息服务(IIS)管理器”,在“IIS管理器”窗口中右键点击“默认SMTP虚拟服务器”选项,在弹出的菜单中选中“属性”,进入“默认SMTP虚拟服务器”窗口,切换到“常规”标签页,在“IP地址”下拉列表框中选中邮件服务器的IP地址即可。点击“确定”按钮,这样一个简单的邮件服务器就架设完成了。  完成以上设置后,用户就可以使用邮件客户端软件连接邮件服务器进行邮件收发工作了。在设置邮件客户端软件的SMTP和POP3服务器地址时,输入邮件服务器的域名“rtj.net”即可。  四、远程Web管理  Windows Server 2003还支持对邮件服务器的远程Web管理。在远端客户机中,运行IE浏览器,在地址栏中输入“https://服务器IP地址:8098”,将会弹出连接对话框,输入管理员用户名和密码,点击“确定”按钮,即可登录Web管理界面。
      

  4.   

    发外网错误信息:[System.Net.Mail.SmtpFailedRecipientException] = {"邮箱不可用。 服务器响应为: 5.7.1 Unable to relay for [email protected]"}
       在 System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
       在 System.Net.Mail.SmtpClient.Send(MailMessage message)
     System.Collections.ListDictionaryInternalStackTrace = "   在 System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)\r\n   在 System.Net.Mail.SmtpClient.Send(MailMessage message)\r\n   在 
    _exceptionMethod = {System.Net.Mail.MailWriter SendMail(System.Net.Mail.MailAddress, System.Net.Mail.MailAddressCollection, System.String, System.Net.Mail.SmtpFailedRecipientException ByRef)}
      

  5.   

    程序是2.0的 没有mail.Fields这个方法
      

  6.   

    这是我项目中用的发邮件的代码,使用没问题,看看对你有没用:
     private void Send(string fromAddress, string fromName, string receiverAddress, string emailSubjet, string emailBody)
            {
                System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
                mail.From = new System.Net.Mail.MailAddress(fromAddress, fromName);
                mail.To.Clear();
                //    添加群发列表
                string[] receivers = receiverAddress.Split(new char[] { ';' });
                foreach (string receiver in receivers)
                {
                    mail.To.Add(new System.Net.Mail.MailAddress(receiver));
                }
                mail.IsBodyHtml = true;
                mail.Subject = emailSubjet;
                mail.Body = emailBody;
                mail.Priority = System.Net.Mail.MailPriority.High;            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
                smtp.Host = ConfigHelper.GetConfig("SMTPServer");
                smtp.Credentials = new System.Net.NetworkCredential(ConfigHelper.GetConfig("SMTPServerUser"), ConfigHelper.GetConfig("SMTPServerPassword"));
                smtp.Send(mail);
            }
      

  7.   

    [System.Net.Mail.SmtpFailedRecipientException] = {"邮箱不可用。 服务器响应为: 5.7.1 Unable to relay for [email protected]"}
    -----------------
    这个提示好像是说[email protected]邮箱有问题吧,试试其他的邮箱(比如gmail)。
      

  8.   

    [System.Net.Mail.SmtpFailedRecipientException] = {"邮箱不可用。 服务器响应为: 5.7.1 Unable to relay for [email protected]"}
    -----------------
    这个提示好像是说[email protected]邮箱有问题吧,试试其他的邮箱(比如gmail)。
    油箱是有的!
      

  9.   

    这个要看你们企业的SMTP服务器的配置吧,有的只准发内肉,这个程序应该内,外网不分的.只要服务器那边配置一下就可以了.
      

  10.   

    一样的,外部邮件也是利用你们公司的邮件服务器来发送的,和我前段时间做的一个邮件系统是一样的,我总结了一下,你可以看看,www.cnblogs.com/ustbwuyi 第一篇文章就是
      

  11.   

    ustbwuyi()===============================你的那个vs2005 能行吗?
      

  12.   

    ConfigHelper   这个文件是什么
      

  13.   

    MailAddress from = new MailAddress("[email protected]", "163");
                MailAddress to = new MailAddress("[email protected]", "163");
                MailMessage message = new MailMessage(from, to);
                message.Subject = "死了";
                message.Body = @"人生自古谁无死!.";
                MailAddress bcc = new MailAddress("[email protected]");
                message.Bcc.Add(bcc);            SmtpClient client = new SmtpClient("smtp.163.com");// new SmtpClient(server);
                client.Credentials = CredentialCache.DefaultNetworkCredentials;
                client.DeliveryMethod = SmtpDeliveryMethod.Network;
                client.Port = 25;
                client.Credentials = new System.Net.NetworkCredential("帐号", "密码");            Console.WriteLine("Sending an e-mail message to {0} and {1}.", to.DisplayName, message.Bcc.ToString());
                try
                {
                    client.Send(message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception caught in CreateBccTestMessage(): {0}",
                        ex.ToString());
                }
    测试,已经可以使用
      

  14.   

    http://www.coridc.com/archives/2120