环境:
服务器端:64bit cpu,win server2008 r2,exchange 2010
客户端:vs2008,vc++
代码:
sprintf_s(m_cSendBuff,"HELO []\r\n"); send(sock,m_cSendBuff,strlen(m_cSendBuff),0);//开始会话 memset(m_cReceiveBuff, 0, sizeof(m_cReceiveBuff)); recv(sock,m_cReceiveBuff,1024,0); if(m_cReceiveBuff[0]!='2' || m_cReceiveBuff[1]!='5' || m_cReceiveBuff[2]!='0') { return false; }
百度,看到一篇文章,Literally IPv6,说exchange 不遵守ipv6造成的问题,于是
1.关闭ipv6:
找到[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters]
新建 DWORD (32-位)值 DisabledComponents 值为 ffffffff (16进制) 重启后生效
2.HELO []里添加ip
sprintf_s(m_cSendBuff,"HELO [%s]\r\n", m_sMailInfo.m_pcIPAddr); send(sock,m_cSendBuff,strlen(m_cSendBuff),0);//开始会话 memset(m_cReceiveBuff, 0, sizeof(m_cReceiveBuff)); recv(sock,m_cReceiveBuff,1024,0); if(m_cReceiveBuff[0]!='2' || m_cReceiveBuff[1]!='5' || m_cReceiveBuff[2]!='0') { return false; }
参考:
http://blog.sina.com.cn/s/blog_6876fb5c0101o85g.html
http://labs.apnic.net/blabs/?p=309