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

  • 相关阅读:
    bzoj4537: [Hnoi2016]最小公倍数
    bzoj4331: JSOI2012 越狱老虎桥
    bzoj4558: [JLoi2016]方
    bzoj4209: 西瓜王
    bzoj2653: middle
    bzoj4671: 异或图
    bzoj4771: 七彩树
    shell java应用启动脚本(app.sh)
    Springboot 构建http服务,返回的http行是'HTTP/1.1 200' 无状态码描述 客户端解析错误
    MariaDB(Mysql)-主从搭建
  • 原文地址:https://www.cnblogs.com/GarfieldTom/p/1553399.html
Copyright © 2011-2022 走看看