Debugging email

Tagged: ,

Viewing 15 posts - 16 through 30 (of 34 total)
  • Author
    Posts
  • #619
    RRowley
    Participant

    I’m not sure what your problem is. I assume you are NOT using the free hosting service on byethost as it has limitations on email.

    Although difficult to find, I did locate the email setup instructions for premium host user on byethost. It is consistent with what you have. However, the same documentation only shows PHP versions up to 5.6x. You are definitely on 7.2x. So it is possible that the knowledge base doc is out of date and there is another email setup option that you can use; possibly using TLS.

    I suggest you talk with your web host support team. They might be able to look at their logs and see why your connection is timing out.

    Other than that, I’m at a loss as to why you are having an issue.

    #624
    ppmt
    Participant

    I am using the premium byethost and what is strange is that if I use the old version of SI (pre swtiftmailer) it works fine so their config is working.

    I have tried another email provider and with them I get a different error.

    Fatal error: Uncaught Swift_TransportException: Expected response code 250 but got code "550", with message "550 Authentication required " in /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457 
    Stack trace: #0 /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(341): Swift_Transport_AbstractSmtpTransport->assertResponseCode('550 Authenticat...', Array) #1 /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport->executeCommand('MAIL FROM:<phil...', Array, Array, false, NULL) #2 /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(390): Swift_Transport_EsmtpTransport->executeCommand('DATA\r\n', Array, Array) #3 /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(497): Swift_Transport_AbstractSmtpTransport->doDataCommand(Array) #4 /var/www/html/vendor/swiftm in /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 457

    so no timeout. The config says to use STARTTLS which I assume is TLS?

    #627
    fearless359
    Keymaster

    Anything I suggest you try is just throwing ideas against the wall and seeing if one sticks. For instance, you can try using port 587 and TLS which is semi-standard. However, the bottom line is what you host email provider requires. So again I suggest you contact them to have them review their logs and tell you why your authentication is being rejected.

    #628
    ppmt
    Participant

    Just a question for you. DO you use your own smtp or a hosted one ?

    I am asking because I have access to a few smtp server and not one of them is working. They all give different errors but bottom line is that I can’t get any of them to work!

    Sorry to be such a pain !

    #629
    fearless359
    Keymaster

    I run my development system on Win 10 using xampp. I run my production system on a Namecheap server for a hosting package I have from which I host a number of websites including my production SI site. I currently use the smtp server through my namecheap site for both development and production. In the past, I have also used smtp through my Comcast and Gmail accounts. I haven’t tried those servers since switching to Swiftmailer but I will give them a try on my development system.

    #630
    ppmt
    Participant

    Me again.

    I send an email to one of the host that doesn’t work (migadu) asking them if there was anything they could do to help me and here is what they told me:

    When sending via our SMTP you have to authenticate. Please configure your email client to use plain text authentication over StartTLS.

    Here is the config I am supposed to enter:

    host: smtp.migadu.com
    user: my email
    password: my password
    port: 587
    security: STARTTLS

    I tried the config in SI with TLS and STARTTLS but the result is the same

    Here is again the error I get with it.

    response code 250 but got code "550", with message "550 Authentication required " in /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457 
    Stack trace: #0 /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(341): Swift_Transport_AbstractSmtpTransport->assertResponseCode('550 Authenticat...', Array) #1 /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport->executeCommand('MAIL FROM:<phil...', Array, Array, false, NULL) #2 /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(390): Swift_Transport_EsmtpTransport->executeCommand('DATA\r\n', Array, Array) #3 /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(497): Swift_Transport_AbstractSmtpTransport->doDataCommand(Array) #4 /var/www/html/vendor/swiftm in /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 457
    #631
    fearless359
    Keymaster

    I was able to send email through my comcast ISP account. Not that it used port 587 for SSL. You might try the SSL setting rather than TLS on yours.

    I did load some updates on github and recommend you pull them before you continue testing. The changes adds additional LOG statements to trace activity via the si.log file and also adds error handling in the case of thrown error messages that previously were not reported.

    Let me know how this works out.

    #632
    ppmt
    Participant

    I tried with SSL and TLS and got the same printout in both case

    2019-09-29T11:19:09-07:00 DEBUG (7): init.php - authentication-enabled[] fake_auth[1]
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - After init.php - module(invoices] view[email]
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - After processing init.php for extensions
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - module[invoices] view[email] databaseBuilt[1] databasePopulated[1]
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - apply_db_patches[1]
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - config->authentication->enabled[] auth_session->id: 1
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - module - invoices
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - still_doing_setup[]
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - module[invoices] view[email] action[] id[1] menu[1]
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - After invoices/template
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - After api/xml or ajax
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - After extension_jquery_files
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - after custom/hooks.tpl
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - after header.tpl
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - After extension_php_insert_files, etc.
    2019-09-29T11:19:09-07:00 DEBUG (7): index.php - my_path[modules/invoices/email.php]
    2019-09-29T11:19:09-07:00 DEBUG (7): email.php - _GET stage[2]
    2019-09-29T11:19:09-07:00 DEBUG (7): Export::getData() module:[invoice]
    2019-09-29T11:19:09-07:00 DEBUG (7): Export::getData() - logo[http://invoices.master2019.org/templates/invoices/logos/_default_blank_logo.png]
    2019-09-29T11:19:09-07:00 DEBUG (7): Export::getData() - templatePath[templates/invoices/default/template.tpl]
    2019-09-29T11:19:09-07:00 DEBUG (7): Export::showData() - format[pdf]
    2019-09-29T11:19:09-07:00 DEBUG (7): Pdf::generate() - pdfname[Invoice_1.pdf] destination[S]
    2019-09-29T11:19:09-07:00 DEBUG (7): Pdf::generate() - Before WriteHTML
    2019-09-29T11:19:09-07:00 DEBUG (7): Pdf::generate() - Before Output
    2019-09-29T11:19:09-07:00 DEBUG (7): Pdf::generate() - returning Output result
    2019-09-29T11:19:09-07:00 DEBUG (7): email.php - After execute
    2019-09-29T11:19:09-07:00 DEBUG (7): email.php - Before send
    2019-09-29T11:19:09-07:00 DEBUG (7): Email::send() - Before Swift_Mailer send()

    I really don’t know what else to do at this stage and will probably stay with the version that is not using swiftmail as it is working

    #633
    ppmt
    Participant

    me again.

    I decided to install a version on SI on my hosted account with byethost and originally I had the exact same problem.

    They advised me to use port 384 instead of 290 and success it worked!!!

    Only problem is that using the same port on my locally hosted is still not working. But I get a different error this time in php.log. I have replaced the name of the hostname and its ip in the log.

    [04-Oct-2019 04:01:34 America/Los_Angeles] PHP Fatal error:  Uncaught Swift_TransportException: Expected response code 354 but got code "503", with message "503-All RCPT commands were rejected with this error:^M
    503-Please turn on SMTP Authentication in your mail client.  <hostname>^M
    503-(invoices.master2019.org) [<my IP>]:60170 is not permitted to relay^M
    503-through this server without authentication.^M
    503 Valid RCPT command must precede DATA^M
    " in /var/www/simpleinvoices/simpleinvoices-master_2019.2/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457
    Stack trace:
    #0 /var/www/simpleinvoices/simpleinvoices-master_2019.2/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(341): Swift_Transport_AbstractSmtpTransport->assertResponseCode('503-All RCPT co...', Array)
    #1 /var/www/simpleinvoices/simpleinvoices-master_2019.2/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport->executeCommand('DATA\r\n', Array, Array, false, N in /var/www/simpleinvoices/simpleinvoices-master_2019.2/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 457
    
    #636
    RRowley
    Participant

    I’ve been working with new ways to handle mail but have not had much success. All I can say for now is make sure your email parameters including the smtp_auth option are properly set.

    #638
    ppmt
    Participant

    yes I think they are good. Was there any reason you decided to switch to swiftmailer?

    #640
    RRowley
    Participant

    The previous logic used Zend email logic. The version of Zend used by SI is no longer supported (Framework 1). So I have been trying to replace its functionality with other packages maintained via composer. Swiftmailer has good reviews and was easy to implement.

    #642
    ppmt
    Participant

    I have been having a long email exchange with the support people at byethost. In the end we could not find the problem but they pointed me to some script example using Switmailer.

    Here is the script swiftmailer.php I have written and put in /modules/invoices:

    
    <?php
    use Inc\Claz\Email;
    print_r( stream_get_transports());
    // Create the Transport
    $transport = (new Swift_SmtpTransport('sv4.byethost4.org', 290, 'ssl'))
      ->setUsername('myusername')
      ->setPassword('mypassword')
      ;
    
    // Create the Mailer using your created Transport
    $mailer = new Swift_Mailer($transport);
    
    // Create a message
    $message = (new Swift_Message('The Subject'))
      ->setFrom(['fromemail@mydomain' => 'John Doe'])
      ->setTo(['toemail@myotherdomain' => 'A name'])
      ->setBody('Here is the message itself')
      ;
    
    // Send the message
    $result = $mailer->send($message);
    ?>

    I then use http://myserver/index.php?module=invoices&view=swiftmail to execute it.
    and it works. The email is sent and received.

    Now if I set the custom.config.php to use the same data like this

    email.host                          = sv4.byethost4.org
    email.smtp_auth                     = true
    email.username                      = myusername
    email.password                      = mypassword
    email.smtpport                      = 290
    email.secure                        = ssl
    email.ack                           = false
    email.use_local_sendmail            = false

    if I then try to send an email the normal then it fails with the Timed Out error!

    I don’t understand!!

    #643
    ppmt
    Participant

    Right!!!!!

    I managed to send an email at last!

    But I had to modify the file Inc/Claz/Email.php line 81 to add ssl like this:

    $transport = new Swift_SmtpTransport($config->email->host, $config->email->smtpport<strong>, 'ssl'</strong>);

    is there any reason why the email.secure from custom.config.php is not used?

    #644
    RRowley
    Participant

    The change to make is to use $config->email->encryption. I’ve been working with this set but haven’t finished testing. I’m still having some issues that I’m trying to track down.

Viewing 15 posts - 16 through 30 (of 34 total)
  • You must be logged in to reply to this topic.