zoukankan      html  css  js  c++  java
  • Indy发送邮件被kbas退掉

    用indy开发了发送邮件程序,通过126,sina等发送邮件可以发送出去,而通过tom,163则被退回,显示被

    kbas系统退回.后来通过观察Foxmail的通讯过程,区别在foxmail发送EHLO指令时用的是一个名字,而indy缺少使用的是邮箱名字.通过直接使用Socket连接发送邮件测试,将EHLO改为名字后发送成功.
    研究indy源码,发现indy中的smtp控件的HelloName属性如果有值的话就使用该属性值,没有值的话则使用其他值:
    if HeloName <> '' then begin
        LNameToSend := HeloName;
      end else begin
        //Note:  IndyComputerName gets the computer name.
        //This is not always reliable in Indy because in Dot.NET,
        //it is done with This is available through System.Windows.Forms.SystemInformation.ComputerName
        //and that requires that we link to a problematic dependancy (Wystem.Windows.Forms).
        //Besides, I think RFC 821 was refering to the computer's Internet
        //DNS name.  We use the Computer name only if we can't get the DNS name.
         LNameToSend := GStack.HostName;
         if LNameToSend = '' then
         begin
           LNameToSend := IndyComputerName;
         end;
      end;
      if UseEhlo and (SendCmd('EHLO ' + LNameToSend ) = 250) then begin //APR: user can prevent EHLO    {Do not Localize}
        Capabilities.AddStrings(LastCmdResult.Text);
        if Capabilities.Count > 0 then begin
          //we drop the initial greeting.  We only want the feature list
          Capabilities.Delete(0);
        end;
      end else begin
        SendCmd('HELO ' + LNameToSend, 250);    {Do not Localize}
      end;
    所有设置一下HelloName属性值即可以发送成功!
    可能还有别的问题,待测!

  • 相关阅读:
    贪婪与非贪婪模式
    Arduino语言介绍
    POJ 3249 记忆化搜索或拓扑排序
    POJ 3177 缩点 + 边双连通图
    POJ 1637 网络流构图
    hdu 1285 拓扑排序+优先队列
    POJ 3160 缩点+拓扑排序+简单dp
    POJ 3592 缩点+拓扑排序+最长路
    针对11级队员的暑假训练计划(初稿)
    POJ 2762 缩点+判断是否是最长链
  • 原文地址:https://www.cnblogs.com/GarfieldTom/p/1553399.html
Copyright © 2011-2022 走看看