From 8408ba055b18788dea716ec1084754521c8430a3 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Wed, 26 Jan 2005 00:14:58 +0000 Subject: [PATCH] Fixed SMTP module to give a real hostname in HELO/EHLO git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11055 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../mail_daemon/outbound_protocols/smtp/smtp.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp b/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp index 630a2740a8..1464c1765e 100644 --- a/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp +++ b/src/add-ons/mail_daemon/outbound_protocols/smtp/smtp.cpp @@ -341,12 +341,18 @@ SMTPProtocol::Open(const char *address, int port, bool esmtp) BString line; ReceiveResponse(line); - - char *cmd = new char[::strlen(address)+8]; + + char localhost[255]; + gethostname(localhost,255); + + if (localhost[0] == 0) + strcpy(localhost,"namethisbebox"); + + char *cmd = new char[::strlen(localhost)+8]; if (!esmtp) - ::sprintf(cmd,"HELO %s"CRLF, address); + ::sprintf(cmd,"HELO %s"CRLF, localhost); else - ::sprintf(cmd,"EHLO %s"CRLF, address); + ::sprintf(cmd,"EHLO %s"CRLF, localhost); if (SendCommand(cmd) != B_OK) { delete[] cmd;