PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Mail » Mail » Bug #1050

Missing EHLO/HELO string

Details

Submitted2004-03-22 08:43 UTC
Fromjacob dot rief at tiscover dot com
Assignedjon
StatusClosed
PackageMail
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2004-03-22 08:43 UTC] jacob dot rief at tiscover dot com

Description:
------------
The Mail_smtp class does not allow to specify an EHLO or HELO string in Mail::factory initialization. Since many receiving smtp-servers do not allow this string to be 'localhost', Mail_smtp is unable to deliver Mail to them. Also, sending 'localhost' HELO string is not RFC821 conform.

Reproduce code:
---------------
$mailer = Mail::factory("smtp", array("host"=>$smtphost, "port"=>25, "auth"=>false));
$mailer->send($entry["email"], $headers, $body);

Actual result:
--------------
This small patch will add this required faeture:

--- Mail/smtp.php.orig 2003-08-22 16:37:38.000000000 +0200
+++ Mail/smtp.php 2004-03-22 09:12:55.000000000 +0100
@@ -40,6 +40,12 @@
var $port = 25;

/**
+ * The SMTP EHLO or HELO.
+ * @var string
+ */
+ var $localhost = 'localhost';
+
+ /**
* Whether or not to attempt to authenticate to the SMTP server.
* @var boolean
*/
@@ -79,6 +85,7 @@
{
if (isset($params['host'])) $this->host = $params['host'];
if (isset($params['port'])) $this->port = $params['port'];
+ if (isset($params['localhost'])) $this->localhost = $params['localhost'];
if (isset($params['auth'])) $this->auth = $params['auth'];
if (isset($params['username'])) $this->username = $params['username'];
if (isset($params['password'])) $this->password = $params['password'];
@@ -112,7 +119,7 @@
{
include_once 'Net/SMTP.php';

- if (!($smtp = new Net_SMTP($this->host, $this->port))) { return new PEAR_Error('unable to instantiate Net_SMTP object'); }
+ if (!($smtp = new Net_SMTP($this->host, $this->port, $this->localhost))) { return new PEAR_Error('unable to instantiate Net_SMTP object'); }
if (PEAR::isError($smtp->connect())) { return new PEAR_Error('unable to connect to smtp server ' . $this->host . ':' . $this->port); }

if ($this->auth) {