当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 删除回复 2003-8-1 19:38:26 删除一条回复,扣除回复人信誉分2分,贴子id:2097551;回复内容:金雪根 saucer .net pa,usa =========== 他就是思归。 删除回复 2003-8-1 19:38:23 删除一条回复,扣除回复人信誉分2分,贴子id:2097551;回复内容:csdn 金雪根 saucer .net pa,usa csdn 孟宪......
    摘要: 在vb程序编译运行时,出现对format、right等函数的编译错误,错误提示为“找不到工程或库”,请大家帮帮忙,给我看看是什么原因引起的,只要不出错了,我就结贴。 ......


发邮件的问题:CC和BCC都收不到(分数不够再加)

我从网上找了一篇能够支持ESmtp的源码,回来以后看到不支持CC和BCC就自己在  
  人家的基础上进行了添加,可是问题出现了,邮件的源文件应该没有问题,邮件构造成功,发件人那里多个人也能正常接收.发送的时候没有任何问题.  
  为了方便大家看清问题,我将构造好的邮件源码,和Send()函数列出,请大家都来帮忙呀!  
  这是构造好的邮件信息:  
  Return-Path:   <angiin@sina.com>  
  Delivered-To:   angiin@sina.com.cn  
  Received:   (qmail   79165   invoked   from   network);   17   Sep   2003   01:41:29   -0000  
  Received:   from   unknown   (HELO   smtp.sina.com.cn)   (61.55.3.65)  
      by   202.106.187.156   with   SMTP;   17   Sep   2003   01:41:29   -0000  
  From:angiin@163.com<angiin@163.com>  
  To:angiin@sina.com.cn<angiin@sina.com.cn>  
  Cc:changlibin@msn.com<changlibin@msn.com>  
  Bcc:faster@163.net<faster@163.net>  
  Subject:=?GB2312?B?v7S/tM3izfjKx7K7ysfE3Lm7t6LLzQ==?=  
  X-Priority:Normal  
  X-MSMail-Priority:Normal  
  Importance:Normal  
  X-Mailer:   Huolx.Pubclass  
  MIME-Version:   1.0  
  Content-Type:   text/plain;  
    boundary="----=_NextPart_000_00D6_01C29593.AAB31770"  
  ------=_NextPart_000_00D6_01C29593.AAB31770  
    charset="gb2312"  
  Content-Transfer-Encoding:   base64  
  这是Send()过程  
  private   bool   SendEmail()    
  {    
  //连接网络    
  try    
  {    
  tc=new   TcpClient(mailserver,mailserverport);    
  }    
  catch(Exception   e)    
  {    
  errmsg=e.ToString();    
  return   false;    
  }    
   
  ns   =   tc.GetStream();    
  SMTPCodeAdd();    
   
  //验证网络连接是否正确    
  if(RightCodeHT[RecvResponse().Substring(0,3)]==null)    
  {    
  errmsg="网络连接失败";    
  return   false;    
  }    
   
   
  string[]   SendBuffer;    
  string   SendBufferstr;    
   
  //进行SMTP验证    
  if(ESmtp)    
  {    
  SendBuffer=new   String[4];    
  SendBuffer[0]="EHLO   "   +   mailserver   +   enter;    
  SendBuffer[1]="AUTH   LOGIN"   +   enter;    
  SendBuffer[2]=Base64Encode(username)   +   enter;    
  SendBuffer[3]=Base64Encode(password)   +   enter;    
  if(!Dialog(SendBuffer,"SMTP服务器验证失败,请核对用户名和密码。"))    
  return   false;    
  }    
  else    
  {    
  SendBufferstr="HELO   "   +   mailserver   +   enter;    
  if(!Dialog(SendBufferstr,""))    
  return   false;    
  }    
   
  //    
  SendBufferstr="MAIL   FROM:<"   +   From   +   ">"   +   enter;    
  if(!Dialog(SendBufferstr,"发件人地址错误,或不能为空"))    
  return   false;    
   
  //    
  SendBuffer=new   string[recipientmaxnum];    
  for(int   i=0;i<recipientmaxnum;i++)  
  {    
   
  SendBuffer[i]="RCPT   TO:<"   +   Recipient[i].ToString()   +">"   +   enter;    
   
  }    
  if(!Dialog(SendBuffer,"收件人地址有误"))    
  return   false;    
   
  SendBufferstr="DATA"   +   enter;    
  if(!Dialog(SendBufferstr,""))    
  return   false;    
   
  SendBufferstr="From:"   +   FromName   +   "<"   +   From   +">"   +enter;    
   
  ///SendBufferstr   +=   "To:=?"+Charset.ToUpper()+"?B?"+Base64Encode(RecipientName)+"?="+"<"+Recipient[0]+">"+enter;    
  SendBufferstr+="To:";  
  for(int   i=0;i<recipientmaxnum;i++)  
  {    
  if   (i<recipientmaxnum-1)  
  {  
  SendBufferstr+=Recipient[i].ToString()   +   "<"   +   Recipient[i].ToString()   +">,";    
  }  
  else  
  {  
  SendBufferstr+=Recipient[i].ToString()   +   "<"   +   Recipient[i].ToString()   +">";    
  }  
  }    
  SendBufferstr+=enter;    
  SendBufferstr+="Cc:";    
  for(int   i=0;i<recipientCCmaxnum;i++)  
  {    
  if   (i<recipientCCmaxnum-1)  
  {  
  SendBufferstr+=RecipientCC[i].ToString()   +   "<"   +   RecipientCC[i].ToString()   +">,";    
  }  
  else  
        SendBufferstr+=RecipientCC[i].ToString()   +   "<"   +   RecipientCC[i].ToString()   +">";    
  }    
  SendBufferstr+=enter;    
   
  SendBufferstr+="Bcc:";    
  for(int   i=0;i<recipientBCCmaxnum;i++)  
  {    
  if   (i<recipientBCCmaxnum-1)  
          SendBufferstr+=RecipientBCC[i].ToString()   +   "<"   +   RecipientBCC[i].ToString()   +">,";    
  else  
  SendBufferstr+=RecipientBCC[i].ToString()   +   "<"   +   RecipientBCC[i].ToString()   +">";    
  }    
  SendBufferstr+=enter;    
  if((Charset=="")||(Charset==null))  
  {    
  SendBufferstr+="Subject:"   +   Subject   +   enter;    
  }    
  else    
  {    
  SendBufferstr+="Subject:"   +   "=?"   +   Charset.ToUpper()   +   "?B?"   +   Base64Encode(Subject)   +"?="   +enter;    
  }    
   
  SendBufferstr+="X-Priority:"   +   priority   +   enter;    
  SendBufferstr+="X-MSMail-Priority:"   +   priority   +   enter;    
  SendBufferstr+="Importance:"   +   priority   +   enter;    
  SendBufferstr+="X-Mailer:   Huolx.Pubclass"   +   enter;    
  SendBufferstr+="MIME-Version:   1.0"   +   enter;    
  if(Html)    
  {    
  SendBufferstr+="Content-Type:   text/html;"   +   enter;    
  }    
  else    
  {    
  SendBufferstr+="Content-Type:   text/plain;"   +   enter;    
  }    
  ///SendBufferstr   +=   "Content-Type:   "+contenttype+";"+enter;//内容格式和分隔符    
  SendBufferstr   +=   "   boundary=\"----=_NextPart_000_00D6_01C29593.AAB31770\""+enter;    
  SendBufferstr   +=   "------=_NextPart_000_00D6_01C29593.AAB31770"+enter;    
  if(Charset=="")    
  {    
  SendBufferstr+="   charset=\"iso-8859-1\""   +   enter;    
  }    
  else    
  {    
  SendBufferstr+="   charset=\""   +   Charset.ToLower()   +   "\""   +   enter;    
  }    
  //SendBufferstr   +=   "Content-Transfer-Encoding:   base64"+enter;    
   
  SendBufferstr+="Content-Transfer-Encoding:   base64"   +   enter   +   enter;    
   
  SendBufferstr+=   Base64Encode(Body)   +   enter;    
  if(Attachments.Count!=0)    
  {    
  foreach(string   filepath   in   Attachments)    
  {    
                                   
  SendBufferstr   +=   "------=_NextPart_000_00D6_01C29593.AAB31770"+enter;    
  SendBufferstr   +=   "Content-Type:   application/octet-stream"+enter;    
  SendBufferstr   +=   "   name=\"=?"+Charset.ToUpper()+"?B?"+Base64Encode(filepath.Substring(filepath.LastIndexOf("\\")+1))+"?=\""+enter;    
  SendBufferstr   +=   "Content-Transfer-Encoding:   base64"+enter;    
  SendBufferstr   +=   "Content-Disposition:   attachment;"+enter;    
  SendBufferstr   +=   "   filename=\"=?"+Charset.ToUpper()+"?B?"+Base64Encode(filepath.Substring(filepath.LastIndexOf("\\")+1))+"?=\""+enter+enter;    
  SendBufferstr   +=   GetStream(filepath)+enter+enter;    
  }    
  }    
  SendBufferstr   +=   "------=_NextPart_000_00D6_01C29593.AAB31770--"+enter+enter;    
                       
                       
  SendBufferstr   +=   enter   +   "."   +   enter;    
   
  if(!Dialog(SendBufferstr,"错误信件信息"))    
  return   false;    
   
   
  SendBufferstr="QUIT"   +   enter;    
  if(!Dialog(SendBufferstr,"断开连接时错误"))    
  return   false;    
   
   
  ns.Close();    
  tc.Close();    
  return   true;    
  }

NO.1   作者: laochen

Well,   I   aware   few   problem   in   your   code   as   below.  
   
  1)   MIME   message   is   just   simply   a   text,   it   will   not   affect   mail   sending   at   all,   you   can   put   whatever   string   inside.   However,   "Bcc"   is   not   supose   to   be   there.   Otherwise,   how   to   make   it   a   "Blind   CC"?  
   
  2)   RCPT   command   should   include   all   the   recipients,   this   includes   "To",   "Cc"   and   "Bcc".   You   code   only   handles   "To"   but   not   "Cc"   &   "Bcc"

NO.2   作者: mzbyxz

已经发了,谢谢


    摘要: 1.某台計算機的速度比改進前提高了10倍,但它僅在50%的時間內可用,這樣一來它的總加 速比為(1.8),答案是怎麼來的呢? 2.32位數10000001010000000000000000000000表示的單精度浮點數為(-5)答案是怎麼來的呢? 3.可保持2000條指令的計算機高速緩沖存儲器(cache),設其中10%的指令用去90%的程序執 行時間,另外10%的時間在程序中得分布是均......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE