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

  • 相关阅读:
    003_cd pushd popd三个命令的区别
    002_更新Nginx证书
    001_nginx常用参数查询
    001_shell经典案例
    001_chrome工具详解
    002_分布式搜索引擎Elasticsearch的查询与过滤
    004_加速国内docker源下载速度
    dango models and database ---- relation ship
    dango models and database ---- verbose name
    MySQL字符集详解
  • 原文地址:https://www.cnblogs.com/GarfieldTom/p/1553399.html
Copyright © 2011-2022 走看看