dbr.email - setup problems

(25 posts) (3 voices)
  1. ajdjackson, Member

    Hi

    I'm trying to configure the environmental setting for email but not being successful.

    Our email server is an Office365 hosted exchange server.

    I've tried the following:

    Host: smtp.office365.com
    Port:587 (I've also tried 25)
    Encryption: TLS
    Username: My Office365 Username
    Password: My Office365 Password

    I've created a simple report to test the settings:

    select 'dbr.mail'; select 'dbr.mail.sender','myOffice365 email address'; select 'dbr.mail.debug', 1;

    select 'My Gmail email address', 'Jake', 'This is a subject', 'Body of the mail';

    I'm receiving the following error:


    SMTP ERROR: Failed to connect to server: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
    (10060)
    SMTP connect() failed.

    Is there anything else I need to do or check?

    Thanks

    Jake

  2. myDBR Team, Key Master

    Looks like your server cannot make connection to smtp.office365.com. You can try to increase the debug level to 2 and check your firewall settings.

    --
    myDBR Team

  3. ajdjackson, Member

    Hi

    Thanks for getting back.

    Setting debug 2 didn't show any more information - exact same error message.

    I believe my ports/firewall settings are OK as I receive alerts from my server using the exact same relay settings. It's a WHS 2011.

    I've also tried smtp.gmail.com but received same error.

    Anything else I can try?

    Jake

  4. myDBR Team, Key Master

    Can you see a connection to Office365 mail server in the log? If not, check the connections.

    --
    myDBR Team

  5. ajdjackson, Member

    Good morning

    I'm making no progress with this :(

    Which logs should I check? It's a windows server based on server 2008.

    I've disabled the server and router firewalls. Still the same error as above.

    I can telnet from the server into the host ok.

    One thing I'm not sure of - do I need to have a smtp server running on the server? Currently that feature hasn't been added.

    Thanks for the help

    Jake

  6. myDBR Team, Key Master

    myDBR will talk directly to SMTP-server you have specified (smtp.office365.com).

    When you enable debug optiopn (level 1 for commands or level 2 for commads and data):

    select 'dbr.mail.debug', 2;

    , you will see the communication between myDBR and the SMTP-server. See if you actually reach smtp.office365.com.

    --
    myDBR Team

  7. ajdjackson, Member

    Hi

    I had tried your suggestion above but didn't get any additional info in the error message.

    I had a look at the class.smtp.php file and added the $host and $username variables to the error message (line 230)-

    . "Host $host" . "User $username"

    The error message doesn't display a username but displays the host as my.mailserver.com

    Is this is what to be expected?

    As I had said earlier the server uses the exact same smtp relay parameters to send me alerts and I received them.

    I also checked php.ini and openssl.dll is enabled.

    Not sure where to go from here (other than the pub!)

    Cheers

    Jake

  8. myDBR Team, Key Master

    That does not seem to be right. What is the output of:

    select * from mydbr_options
    where name='mail_host';

    Do you have the 'my.mailserver.com' defined in user/defaults.php?

    --
    myDBR Team

  9. ajdjackson, Member

    Hi

    I get this from the query:

    0 mail_host s:18:"smtp.office365.com";
    myusername 2 mail_host s:0:"";

    There are no entries in the user/defaults to do with email/email server.

    Strange.

    Is my.mailserver.com one of your defaults?

    Jake

  10. myDBR Team, Key Master

    Check the user/extension_init.php file and remove all mail-related definitions.

    --
    myDBR Team

  11. ajdjackson, Member

    Hi

    If I comment out all references to mail in the above file I'm back to where I was before except the host is no longer shown. It's as if the options are not been read.

    When I populate the extension_init.php file with my smtp details I get connected now but fail with SMTP ERROR: Password command failed: 334 VXNlcm5hbWU6

    The password is correct. I'm using 'tls' as the secure option.

    Jake


    2016-04-09 15:18:19 SERVER -> CLIENT: 220 DBXPR04CA0045.outlook.office365.com Microsoft ESMTP MAIL Service ready at Sat, 9 Apr 2016 15:18:18 +0000
    2016-04-09 15:18:19 CLIENT -> SERVER: EHLO xxx.xxx.com
    2016-04-09 15:18:19 SERVER -> CLIENT: 250-DBXPR04CA0045.outlook.office365.com Hello [xxx.xxx.xxx.xxx]
    250-SIZE 157286400
    250-PIPELINING
    250-DSN
    250-ENHANCEDSTATUSCODES
    250-STARTTLS
    250-8BITMIME
    250-BINARYMIME
    250 CHUNKING
    2016-04-09 15:18:19 CLIENT -> SERVER: STARTTLS
    2016-04-09 15:18:19 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
    2016-04-09 15:18:19 CLIENT -> SERVER: EHLO xxx.xxx.com
    2016-04-09 15:18:19 SERVER -> CLIENT: 250-DBXPR04CA0045.outlook.office365.com Hello [xxx.xxx.xxx.xxx]
    250-SIZE 157286400
    250-PIPELINING
    250-DSN
    250-ENHANCEDSTATUSCODES
    250-AUTH LOGIN
    250-8BITMIME
    250-BINARYMIME
    250 CHUNKING
    2016-04-09 15:18:19 CLIENT -> SERVER: AUTH LOGIN
    2016-04-09 15:18:19 SERVER -> CLIENT: 334 VXNlcm5hbWU6
    2016-04-09 15:18:19 CLIENT -> SERVER:
    2016-04-09 15:18:19 SERVER -> CLIENT: 334 VXNlcm5hbWU6
    2016-04-09 15:18:19 CLIENT -> SERVER:
    2016-04-09 15:18:19 SERVER -> CLIENT: 334 VXNlcm5hbWU6
    2016-04-09 15:18:19 SMTP ERROR: Password command failed: 334 VXNlcm5hbWU6
    2016-04-09 15:18:19 CLIENT -> SERVER: QUIT
    2016-04-09 15:18:19 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
    2016-04-09 15:18:19 SMTP ERROR: QUIT command failed: 334 UGFzc3dvcmQ6
    SMTP connect() failed.

  12. myDBR Team, Key Master

    Looks better now. You are connecting to MS mail server, your TLS works. It is just that the MS server is not accepting the authentication.

    Double check the username and password and check that Office365 allows for you to use SMTP.

    --
    myDBR Team

  13. ajdjackson, Member

    Hi

    My login credentials are correct - I've checked several times.

    I've also tried using the gmail smtp relay and receive a similar error:

    SMTP ERROR: Password command failed: 535-5.7.8 Username and Password not accepted. Learn more at
    535 5.7.8 https://support.google.com/mail/answer/14257 u145sm8741457wmu.17 - gsmtp

    Is there anyway I can display what username and password are being sent ie on what line in do I add $username $password? I've tried adding them to line 721 in class.smtp.php but they display no data.

    I'm not convinced that these parameters are being correctly set.

    Cheers and sorry for the hassle

    Jake

  14. myDBR Team, Key Master

    Jake,
    do not change the class.smtp.php-file. If you want to debug, use the mail-extension from extensions/mail/mail.php.

    Note that if you are using 2-step verification in gmail, you need to create application specific password. See Google documentation for this.

    --
    myDBR Team

  15. ajdjackson, Member

    Hi

    Thanks for the pointer.

    There is definitely something strange with my setup.

    In the extensions/mail/mail.php I commented out lines 72-77 and added:

    $mail->Username = 'myemail@address';
    $mail->Password = 'mypassword';

    I also have populated $mydbr_mail = array in the extension_init.php file with the smtp relay details etc.

    I have nothing in the environmental settings.

    This worked first time!

    If I comment out the $mydbr_mail in the extension_init.php file and re-enter the exact same details into the environmental settings the email send fails at the initial server connection.

    So it looks liketo me my system is not reading/using the environmental settings.

    Any thoughts?

    Jake

  16. myDBR Team, Key Master

    Jake,
    please remove the $mydbr_mail-array from environmental settings, it's there only for compatibility reasons and is not used in newer installations.

    Make all the definitions in environmental settings and restore the original extensions/mail/mail.php by running the updater. If you still have problems after this, open a support ticket and we'll take a look at it.

    --
    myDBR Team

  17. ajdjackson, Member

    Good morning

    Just got around to doing what you asked.

    I have removed $mydbr_mail-array from the user/extension-init

    The smtp relay settings are in the environmental settings.

    I ran the updater.

    I'm back to where I started again with SMTP ERROR: Failed to connect to server.

    Jake

  18. ajdjackson, Member

    Hi

    Maybe this is significant.

    When I run the query select * from mydbr_options where name='mail_host'; as previously I get :


    User authentication name value
    0 mail_host 's:18:"smtp.office365.com";'
    myusername 2 mail_host 's:0:"";'

    However when I look at the options specific to my username they are:

    mail_host - s:0"";
    mail_password - s:0"";
    mail_from_email - 's:20:"mydbr@my_company.com";'
    mail_from_name - s:15:"myDBR Reporting";
    mail_port - i:25;

    The smtp relay details I entered into the environmental settings are attached to 'blank' user with authentication 0.

    Cheers

    Jake

  19. myDBR Team, Key Master

    Yes,
    that is probably what is causing all the problems. The mail_-settings should not be user-specific.

    The best solution would be to delete all options under your username. You can then re-set the them from the Preferences.

    What is the "smtp relay details" in environmental settings you are referring to?

    --
    myDBR Team

  20. ajdjackson, Member

    Hi

    Deleted all mail-associated settings from mydbr_options table.

    dbr.mail now working :)

    The smtp relay settings I was referring to are the Mail settings in environmental settings.

    I've a couple of other queries associated with dbr.mail, such as creating a button and having a report exported as pdf and then emailed but I'll raise these as separate ticket.

    Cheers

    Jake

  21. myDBR Team, Key Master

    Note that you should reset all your settings from mydbr_options table as false settings will most likely has affect to other things as mail as well.

    --
    myDBR Team

  22. john, Member

    updating will likely solve this, so below may not useful to anyone

    Same thing happened to me, rebooting the machine seemed to be a temporary fix but then i tried to change the from address in the environment settings and mail stopped working.

    step 1
    I deleted all the mail rows from table mydbr_options table that had the DBA username (including my pswd reset rows so likely should have deleted less rows)
    step 2
    still doesn't work when running from a the logged in user DBA (see response under notes below)
    step 3
    the report is set as available without login via url, so i opened a private window and logged in as a non admin user and ran the url and it worked.

    Notes
    debug =5 shows 2 lines when running report from dba user
    2015-07-08 00:47:28 Connection: opening
    2015-07-08 00:47:28 SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: No address associated with hostname (0)
    SMTP connect() failed.

    but from other user it shows about 100 including the whole attachment (pdf) converted to text.

    I don't need to email reports when logged in as admin so shouldn't be problem

  23. myDBR Team, Key Master

    If you have problems with mail following should fix it:

    1) Go to environmental settings check mail settings and save.
    2) Log out and log back in

    If this does not help then:

    3) Check that no user (including dba) have mail settings in mydbr_options (mail settings are global and should be just for the empty (global) user):

    select *
    from mydbr_options
    where user != '' and name like 'mail%'

    4) If such rows exists, delete them, log out and log back in.

    Note that if your server has already working mail setup, you can use mail instead of external SMTP-server. Other alternatives include Sendmail and Qmail).

    --
    myDBR Team

  24. john, Member

    Thanks yes our isp allows us to send emails on port 22, and gmail doesn't respect custom from addresses. So it is on my list to look into the alternatives.

    i didn't try the logout/in after changes, thanks

    anytime i make changes in the environment variables settings for the mail settings it seems to recreate the table entries with user dba. I know what to look for now and probably a good reason to update.

  25. myDBR Team, Key Master

    The environment variables are stored in the session, so if you delete the entries and save the environment settings without logging out, you will re-create them. Delete the extra entries and log out.

    Updating to latest build is always recommended.

    --
    myDBR Team


Reply

You must log in to post.