Forums / Setup & design / SMTP Authentication

SMTP Authentication

Author Message

Guido Faecke

Monday 02 April 2007 2:25:24 pm

Hi folks,

after spending 2 nights and today with getting SMTP for notification running i found a solution that is working for me.

Right now i'm running version 3.9.1 on an cpanel/redhat setup, and yes, i have root access.
it was easy for me to get the mail notification with sendmail working. but i usually set in cpanel/whm the sendmail option for php to false.
so i tried to get SMTP working... which was not so easy...
that is my working site.ini setting...

[MailSettings]
Transport=SMTP
AdminEmail=ezadmin@<my-domain>
EmailSender=ezadmin@<my-domain>
TransportServer=<my-mail-server>
TransportUser=<mail-user-name>
TransportPassword=<mail-user-password>

BUT... all i got was

[ Apr 02 2007 13:35:57 ] [x.x.x.x] eZSMTPTransport::sendMail():
Error sending SMTP mail: RCPT TO:<testuser9@xxxxx.xxx> command failed, output: 550-firstnetguard.com (mail.usa-info.net)
[x.x.x.x] is currently not
550-permitted to relay through this server. Perhaps you have not logged into
550-the pop/imap server in the last 30 minutes or do not have SMTP
550 Authentication turned on in your email client.
[ Apr 02 2007 13:35:57 ] [x.x.x.x] eZSMTPTransport::sendMail():
Error sending SMTP mail: DATA command failed, output: 503 valid RCPT command must precede DATA

For me the problem is the AUTH section is /lib/ezutils/classes/ezsmtp.php
While the original script is using the command "AUTH", my server reject this comand.
After i figured out that i need to send "AUTH PLAIN <login-data>" i changed the script from:

        function auth()
        {
            /* if the connection is made */
            if ( $this->send_cmd('AUTH', '334' ) )
            {
                /* if sending username ok */
                if ( $this->send_cmd( base64_encode( $this->user ), '334' ) )
                {
                    /* if sending password ok */
                    if ( $this->send_cmd( base64_encode( $this->pass ), '235' ) )
                    {
                        /* set the authenticated  flag and return TRUE */
                        $this->authenticated = TRUE;
                         return TRUE;
                    }
                }
            }
            /* in other case return FALSE */
            return FALSE;
        }

to:

        function auth()
        {
            /* if the connection is made */
            if ( $this->send_cmd('AUTH PLAIN ' . base64_encode( chr(0) . $this->user . chr(0) . $this->pass), '235' ) )
            {
                        /* set the authenticated  flag and return TRUE */
                        $this->authenticated = TRUE;
                         return TRUE;
            }
            /* in other case return FALSE */
            return FALSE;
        }

that works perfect for me!

I hope someone else can use this for a similar problem.
I know it's just a quick-and-dirty fix, but with a little more afford and 1 or 2 ini-settings, it could be usable for everybody who is using different AUTH methods.

See you,
Guido

my first ezPublish setup (test) ever with http://www.usa-info.net

Guido Faecke

Monday 02 April 2007 3:08:27 pm

so, i changed it a little bit more...

        function auth()
        {
            /* if the connection is made */
            /* changed from "AUTH" to "AUTH LOGIN" by G.Faecke */
            //if ( $this->send_cmd('AUTH', '334' ) )
            if ( $this->send_cmd('AUTH LOGIN', '334' ) )
            {
                /* if sending username ok */
                if ( $this->send_cmd( base64_encode( $this->user ), '334' ) )
                {
                    /* if sending password ok */
                    if ( $this->send_cmd( base64_encode( $this->pass ), '235' ) )
                    {
                        /* set the authenticated  flag and return TRUE */
                        $this->authenticated = TRUE;
                         return TRUE;
                    }
                }
            }
            /* added "AUTH PLAIN" by G.Faecke */
            if ( $this->send_cmd('AUTH PLAIN', '334' ) )
            {
                if ( $this->send_cmd( base64_encode( chr(0) . $this->user . chr(0) . $this->pass), '235' ) )
                {
                    /* set the authenticated  flag and return TRUE */
                    $this->authenticated = TRUE;
                    return TRUE;
                }
            }
            /* in other case return FALSE */
            return FALSE;
        }

I hope that's ok ;-)

Guido

my first ezPublish setup (test) ever with http://www.usa-info.net

eZ debug

Timing: Jan 18 2025 19:20:47
Script start
Timing: Jan 18 2025 19:20:47
Module start 'content'
Timing: Jan 18 2025 19:20:48
Module end 'content'
Timing: Jan 18 2025 19:20:48
Script end

Main resources:

Total runtime0.9499 sec
Peak memory usage4,096.0000 KB
Database Queries189

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.1172180.8438
Module start 'content' 0.00630.8031 769.9609482.7188
Module end 'content' 0.80950.1404 1,252.6797337.8125
Script end 0.9498  1,590.4922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.4270210.0002
Check MTime0.00160.1667210.0001
Mysql Total
Database connection0.00070.070910.0007
Mysqli_queries0.880492.68171890.0047
Looping result0.00190.20081870.0000
Template Total0.924397.320.4621
Template load0.00190.201220.0010
Template processing0.922497.100520.4612
Template load and register function0.00030.030710.0003
states
state_id_array0.00070.075710.0007
state_identifier_array0.00120.131620.0006
Override
Cache load0.00160.1723410.0000
Sytem overhead
Fetch class attribute can translate value0.00160.165120.0008
Fetch class attribute name0.00180.185920.0009
XML
Image XML parsing0.00040.044920.0002
class_abstraction
Instantiating content class attribute0.00000.000720.0000
General
dbfile0.00230.2409210.0001
String conversion0.00000.000930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs