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属性值即可以发送成功!
    可能还有别的问题,待测!

  • 相关阅读:
    Jenkins发布遇到的问题
    js相关问题总结
    代码洁癖症轻度患者-页面显示状态判断解决方案
    eclipse没有打断点,项目确仍然要进入断点的问题。
    liunx新装tomcat之后,tomcat不能识别新发布的项目
    phpstorm+xdebug单步调试的配置
    laravel 路由前缀,路由名称前缀区别
    Specified key was too long ... 767 bytes
    postman 自动化测试
    Linux top输出st 的值过高导致系统负载过高
  • 原文地址:https://www.cnblogs.com/china1/p/3400036.html
Copyright © 2011-2022 走看看