在做一个发送邮件的时候遇到一些问题.
我做了一个DLL类
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Mail;
using System.Collections;namespace smtp
{
    public class Class1
    {
        public void sendmail(Hashtable hashtable)
       {
           MailMessage mail = new MailMessage();           string mailTo, mailFrom, cc, Bcc, password, attachments, subject, body, username, smtp;
           //收邮件地址
            mailTo = hashtable["mailTo"].ToString();
            mail.To = mailTo;           //发邮件地址
           mailFrom = hashtable["mailFrom"].ToString();
           mail.From = mailFrom;           //邮件附件
           attachments = hashtable["attachments"].ToString();
           if (attachments != null && attachments != "")
           {
             mail.Attachments.Add(new MailAttachment(attachments));
           }
           
           //邮件抄送
           cc = hashtable["cc"].ToString();
           mail.Cc = cc;           //邮件暗送
           Bcc = hashtable["Bcc"].ToString();
           mail.Bcc = Bcc;
           
           //设置server
           //int i = mailFrom.IndexOf('@');
           //string server = mailFrom.Substring(i + 1, (mailFrom.Length - i - 1));           //主题
           subject = hashtable["subject"].ToString();
           mail.Subject = subject;           //内容
           body = hashtable["mailbody"].ToString();
           mail.Body = body;
           //发信人姓名
           username = hashtable["username"].ToString();           //密码
           password = hashtable["password"].ToString();           //smtp服务器
       //    smtp = hashtable["smtp"].ToString();       //    try
    //       {
               //设置为需要用户验证 
    //           mail.Fields.Add(@"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
               //value=0 代表Anonymous验证方式(不需要验证)
               //value=1 代表Basic验证方式 使用basic (clear-text) authentication. 
               //Value=2 代表NTLM验证方式 Secure Password Authentication in Microsoft Outlook Express               //设置验证用户名
    //           mail.Fields.Add(@"http://schemas.microsoft.com/cdo/configuration/sendusername", username);               //设置验证密码
    //           mail.Fields.Add(@"http://schemas.microsoft.com/cdo/configuration/sendpassword", password);               //设置smtp服务器
                 SmtpMail.SmtpServer = smtp;              //少部分邮箱smtp不为这个规律
               //SmtpMail.SmtpServer = "mail338.lolipop.jp";        //公司smtp服务器
               //SmtpMail.SmtpServer = "seikacn.changeip.org";               //发送邮件
            //   SmtpMail.Send(mail);
   //        }
   //        catch (Exception ex)
  //         {
              
  //         }
       }
    }
}
现在我不设置smtp服务器,邮件一样能发出 .所以我很是不理解,所以想请教高手.mailmessage里面是不是封装了smtp服务器.?????