From 8ec93e416a2ce616069907861b16cdf81e29682b Mon Sep 17 00:00:00 2001 From: Bubar Date: Wed, 9 Sep 2015 16:58:36 +0200 Subject: [PATCH 1/2] PHP 5.3 incompat --- src/ufront/mail/Email.hx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ufront/mail/Email.hx b/src/ufront/mail/Email.hx index 5c91f3c..656e725 100644 --- a/src/ufront/mail/Email.hx +++ b/src/ufront/mail/Email.hx @@ -150,10 +150,12 @@ class Email { If no such header exists, it will return `null`. **/ public function getHeader( name ):Null { - if ( headers.exists(name) ) - return headers.get( name )[0]; - else + if ( headers.exists(name) ) { + var h = headers.get( name ); + return h[0]; + }else{ return null; + } } /** From abcb25470b8b1289e3405201297c8ef0fdcbf8e3 Mon Sep 17 00:00:00 2001 From: fbarbut Date: Fri, 12 Aug 2016 14:22:02 +0200 Subject: [PATCH 2/2] ask if ESMTP features are available by connecting with EHLO as specified in the RFC --- src/ufront/mailer/SmtpMailer.hx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ufront/mailer/SmtpMailer.hx b/src/ufront/mailer/SmtpMailer.hx index cf45151..fd3f346 100644 --- a/src/ufront/mailer/SmtpMailer.hx +++ b/src/ufront/mailer/SmtpMailer.hx @@ -141,22 +141,25 @@ class SmtpMailer implements UFMailer { throw ConnectionError(host,port); } + var esmtp = false; var supportLoginAuth = false; // get server init line var ret = StringTools.trim(cnx.input.readLine()); - var esmtp = ret.indexOf("ESMTP") >= 0; - while (StringTools.startsWith(ret, "220-")) { ret = StringTools.trim(cnx.input.readLine()); } + + //see https://en.wikipedia.org/wiki/Extended_SMTP + cnx.write( "EHLO " + Host.localhost() + "\r\n"); + ret = StringTools.trim(cnx.input.readLine()); + if ( ret.substr(0, 3) == "250" ){ + esmtp = true; + } + if ( esmtp ) { //if server support extensions - //EHLO - cnx.write( "EHLO " + Host.localhost() + "\r\n"); - ret = ""; - do { ret = StringTools.trim(cnx.input.readLine()); if( ret.substr(0,3) != "250" ){