prashants / webzash

Easy to use web based double entry accounting software in PHP - MySQL under MIT License
http://webzash.org
Other
207 stars 109 forks source link

Configure Gmail with Webzash #158

Open jessicana opened 2 years ago

jessicana commented 2 years ago

Hey,

Are the below settings correct to configure gmail with webzash?

image

prashants commented 2 years ago

Since you want to use TLS use port 587

jessicana commented 2 years ago

Thanks! I used 587 and now I can confirm that the email is not working as I want on webzash. This is due to a problem at my end that I try to know what is it. How can I debug this issue on webzash? To be clear, I have the same issue on my mail server that it also does not send emails with webzash although it was just fine previously. See below the error message. I understand that I can go to my gmail account security and allow less secure apps to "ON", I did that but it did not solve my problem. Do you think Fail2ban has anything to do with this?

The challenge I have is that if I click forget password using webzash forget password link, I cannot sign in until I get an email to reset my password, since I have a problem getting emails, I got blocked. I noticed that when I click on forget password link and try to sign in after that using my correct credentials, webzash does not accept my sign-in attempt and starts counting 5, 4, 3,2,1 and blocks me. MTEISMU

prashants commented 2 years ago

Try without TLS

jessicana commented 2 years ago

I tried with and without TLS. It did not work.

prashants commented 2 years ago

I will check and let you know

prashants commented 2 years ago

This is what worked for me :-

Protocol : Smtp Hostname : smtp.gmail.com Port : 587 Use TLS : Yes (Checked) Username : @.* Password : **** From : abc

In Gmail settings : Enable access to less secure apps

Go to : https://myaccount.google.com > Security > Less secure apps > Allow less secure apps: ON

I haven't checked how to send email without turning on less secure apps. Will do it later. This feature was not there when the app was developed many years ago.

On Fri, Oct 22, 2021 at 8:17 AM Prashant Shah @.***> wrote:

I will check and let you know

jessicana commented 2 years ago

Your configuration is correct but it did not work. I am unable to get webzash to work again with gmail or any other email. The email problem started when I set a password on webzash URL so that I only access the URL and never went away even after I canceled out the password protection. I am not sure what problem has this protection caused. Although I canceled out the below lines:

#      auth_basic "Login";
#      auth_basic_user_file /etc/nginx/.htpasswd;

The problem never went away. Below is the whole block:

  ## Nginx Configuration for Webzash
  location ^~ /webzash
  {
    root /var/www/example.com/html/root
    index index.php;
    try_files $uri $uri/ /webzash/index.php;

    location ~ \.php$
    {
      try_files $uri =404;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_pass unix:/run/php/php8.0-fpm.sock;
  ### Protect webzash using a username and password
      auth_basic "Login";
      auth_basic_user_file /etc/nginx/.htpasswd;
    }
  }
prashants commented 2 years ago

Pls check the log files to see the exact problem

On Mon, Oct 25, 2021, 5:51 AM jessicana @.***> wrote:

This did not work. The email problem started when I set a password on webzash URL so that I only access the URL and never went away even after I canceled out the password protection. I am not sure what problem has this protection caused. Although I canceled out the below lines:

auth_basic "Login";

auth_basic_user_file /etc/nginx/.htpasswd;

The problem never went away. Below is the whole block:

Nginx Configuration for Webzash

location ^~ /webzash { root /var/www/example.com/html/root index index.php; try_files $uri $uri/ /webzash/index.php;

location ~ \.php$
{
  try_files $uri =404;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  fastcgi_pass unix:/run/php/php8.0-fpm.sock;

Protect webzash using a username and password

  auth_basic "Login";
  auth_basic_user_file /etc/nginx/.htpasswd;
}

}

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-950426446, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULAXTMSDVEVOVGDMXVDUISPHRANCNFSM5GKOQ25A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jessicana commented 2 years ago

I did check Nginx error logs - no problem!

prashants commented 2 years ago

Can you try the mail option which will use your local mail server if you are hosting the app online.

Maybe firewall is blocking the smtp connections.

jessicana commented 2 years ago

I suspect that the firewall is blocking it. I am not sure how to go around it - to be honest ..

prashants commented 2 years ago

https://github.com/prashants/webzash/issues/151#issuecomment-942838109

You can try inserting this code in the same place as above and see what error message you are getting

public $gmail = array(
  'host' => 'ssl://smtp.gmail.com',
  'port' => 465,
  'username' => 'youremailid@gmail.com',
  'password' => 'yourpassword',
  'transport' => 'Smtp',
  'timeout' => 30
);

$email = new CakeEmail('gmail');
$email->from('youremailid@gmail.com')
->to('some@gmail.com')
->subject('Hello !')
->send("Sample message");

More settings option are given below...

https://book.cakephp.org/2/en/core-utility-libraries/email.html

jessicana commented 2 years ago

Thanks! This is the way I want to debug this error. I used the above code and inserted that under:

/**
 * login method
 */
    public function login() {

in the WzusersController.php and I go this syntax error:

Errors
syntax error, unexpected token "public"
Error: An Internal Error Has Occurred.

Stack Trace
[internal function] → App::load()
CORE/Cake/Routing/Dispatcher.php line 266 → class_exists()
CORE/Cake/Routing/Dispatcher.php line 235 → Dispatcher->_loadController()
CORE/Cake/Routing/Dispatcher.php line 158 → Dispatcher->_getController()
APP/webroot/index.php line 117 → Dispatcher->dispatch()
ROOT/index.php line 41 → require(string)

This would be very helpful if it works!

jessicana commented 2 years ago

This is what I get when I try to email an entry to an email:

image

This remains there until I refresh the page!

prashants commented 2 years ago

Ok can you install any other php based app like WordPress, etc and check if gmail is working with it

On Fri, Nov 12, 2021, 6:53 AM jessicana @.***> wrote:

This is what I get when I try to email an entry to an email:

[image: image] https://user-images.githubusercontent.com/7415824/141392645-00ab05a7-4ba1-4ce4-b9cd-407a6409aa1d.png

This remains there until I refresh the page!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-966743285, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULGEXMNDBH22RP775TDULRUC3ANCNFSM5GKOQ25A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jessicana commented 2 years ago

It is working. I was thinking to uninstall webzash and install it again and see if the email would work after that..

prashants commented 2 years ago

What is working. Reinstalling won't help.

On Sat, Nov 13, 2021, 8:59 AM jessicana @.***> wrote:

It is working. I was thinking to uninstall webzash and install it again and see if this works

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-967771754, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULEMU3ZKFTCMOSLER73ULXLRBANCNFSM5GKOQ25A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jessicana commented 2 years ago

The mail server (i.e., sending and receiving emails) is working with other apps but not with webzash

prashants commented 2 years ago

What settings are you using for other apps

On Sat, Nov 13, 2021, 9:59 PM jessicana @.***> wrote:

The mail server (i.e., sending and receiving emails) is working with other apps but not with webzash

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-968095271, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULBA34GREN3Y736GJHLUL2G5ZANCNFSM5GKOQ25A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Ain45 commented 2 years ago

I have the same problem on a new computer, webzash is not sending email. I use XAMPP on my computers. Yesterday I started trying on an old computer and everything is working. Now I also tried a child's laptop and everything works in it. What's blocking email on my new computer? I set tls 587 on all computers. The new computer also has Avast antivirus, others do not have antivirus protection. What else can hinder this program? Thank you!

jessicana commented 2 years ago

Well, thank you @Ain45 I think it is not working on these settings: Protocol: SMTP Port: 587 Use TLS: Enabled Username: mail.example.org Password: XXX From: my email

I use mailcow and the SRV domain settings is properly configured: _submission._tcp IN SRV 0 1 587 mail.example.org. (your ${MAILCOW_HOSTNAME})

@prashants If there is any further information I can provide, please let me know.

If you can embed PHPMailer in the software is would resolve this problem. I noticed it stopped working all of a sudden as @Ain45 said.

My email works perfectly on across all platforms except on webzash.

prashants commented 2 years ago

I will look into it.

On Sat, Nov 20, 2021 at 6:19 AM jessicana @.***> wrote:

Well, thank you @Ain45 https://github.com/Ain45 I think it is not working on these settings: Protocol: SMTP Port: 587 Use TLS: Enabled Username: mail.example.org Password: XXX From: my email

I use mailcow https://mailcow.github.io/mailcow-dockerized-docs/prerequisite-dns/ and the SRV domain settings is properly configured: _submission._tcp IN SRV 0 1 587 mail.example.org. (your ${MAILCOW_HOSTNAME})

If there is any further information I can provide, please let me know.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-974560777, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULAY3I2E7VBENX7WDADUM3WBVANCNFSM5GKOQ25A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jessicana commented 2 years ago

Any update on this is highly appreciated :)

jessicana commented 2 years ago

Hey, I tried to configure sending emails with my existing webzash installation using different mailserver and it worked. I also tried a fresh install of webzash but my existing mailserver could not send emails. I contacted the support team of my mailserver about the warning I get on the backend when I try to send emails from webzash as I get this warning: warning: TLS library problem: error:14094415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired:../ssl/record/rec_layer_s3.c:1543:SSL alert number 45:

Their support team said this: The warning with the expired certificate came from webzash, right? I would say that this Software has not been up to date regarding the trusted certificate chains. In 2019 (i think) the root CA Certificate from Let's Encrypt has gone invalide, and if your Software isnt updated, they probably dont know about the new valide chain and thinks it is invalid.

I also followed troubleshooting steps on my end such as:

  1. Re-enabling TLS 1.0 and TLS 1.1
  2. Forcing renewal. I got —> Certificate signed! —> command completed successfully but none solved this issue

Is there any update batch that webzash could release to resolve this issue?

prashants commented 2 years ago

Oh ! Let me check.

"The warning with the expired certificate came from webzash, right?" - I am using cakephp so it must be from their end.

On Sun, Jun 26, 2022 at 11:18 PM jessicana @.***> wrote:

Hey, I tried to configure sending emails with my existing webzash installation using different mailserver and it worked. I also tried a fresh install of webzash but my existing mailserver https://github.com/mailcow could not send emails. I contacted the support team of my mailserver on github on the warning I get on the backend when I try to send emails from webzash as I get this warning: warning: TLS library problem: error:14094415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired:../ssl/record/rec_layer_s3.c:1543:SSL alert number 45:

Their support team said this: The warning with the expired certificate came from webzash, right? I would say that this Software has not been up to date regarding the trusted certificate chains. In 2019 (i think) the root CA Certificate from Let's Encrypt has gone invalide, and if your Software isnt updated, they probably dont know about the new valide chain and thinks it is invalid.

Is there any update batch that can help us resolve this issue?

— Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-1166599656, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULCYOZF6CM5E6OWESMDVRCJXVANCNFSM5GKOQ25A . You are receiving this because you were mentioned.Message ID: @.***>

prashants commented 2 years ago

https://www.dereuromark.de/2021/05/27/nginx-setup-for-your-cakephp-apps/

On Mon, 27 Jun, 2022, 7:44 am Prashant Shah, @.***> wrote:

Oh ! Let me check.

"The warning with the expired certificate came from webzash, right?" - I am using cakephp so it must be from their end.

On Sun, Jun 26, 2022 at 11:18 PM jessicana @.***> wrote:

Hey, I tried to configure sending emails with my existing webzash installation using different mailserver and it worked. I also tried a fresh install of webzash but my existing mailserver https://github.com/mailcow could not send emails. I contacted the support team of my mailserver on github on the warning I get on the backend when I try to send emails from webzash as I get this warning: warning: TLS library problem: error:14094415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired:../ssl/record/rec_layer_s3.c:1543:SSL alert number 45:

Their support team said this: The warning with the expired certificate came from webzash, right? I would say that this Software has not been up to date regarding the trusted certificate chains. In 2019 (i think) the root CA Certificate from Let's Encrypt has gone invalide, and if your Software isnt updated, they probably dont know about the new valide chain and thinks it is invalid.

Is there any update batch that can help us resolve this issue?

— Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-1166599656, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULCYOZF6CM5E6OWESMDVRCJXVANCNFSM5GKOQ25A . You are receiving this because you were mentioned.Message ID: @.***>

prashants commented 2 years ago

Can you update with latest version of webzash which uses most recent cakephp

On Sun, 26 Jun, 2022, 11:18 pm jessicana, @.***> wrote:

Hey, I tried to configure sending emails with my existing webzash installation using different mailserver and it worked. I also tried a fresh install of webzash but my existing mailserver https://github.com/mailcow could not send emails. I contacted the support team of my mailserver on github on the warning I get on the backend when I try to send emails from webzash as I get this warning: warning: TLS library problem: error:14094415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired:../ssl/record/rec_layer_s3.c:1543:SSL alert number 45:

Their support team said this: The warning with the expired certificate came from webzash, right? I would say that this Software has not been up to date regarding the trusted certificate chains. In 2019 (i think) the root CA Certificate from Let's Encrypt has gone invalide, and if your Software isnt updated, they probably dont know about the new valide chain and thinks it is invalid.

Is there any update batch that can help us resolve this issue?

— Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-1166599656, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULCYOZF6CM5E6OWESMDVRCJXVANCNFSM5GKOQ25A . You are receiving this because you were mentioned.Message ID: @.***>

jessicana commented 1 year ago

I tried that on a fresh install and it did not work with Mailcow. It works with other mailserver but not with mailcow. I tested a fresh install of webzash and mailcow. Not a firewall issue. It is a TLS issue.

prashants commented 1 year ago

Ok. Can you explain your setup a bit like where it is hosted, mailserver, how you are sending email, etc.

You can email me on my personal email id all these details.

On Thu, Jul 14, 2022 at 8:50 AM jessicana @.***> wrote:

I tried that on a fresh install and it did not work with Mailcow. It works with other mailserver but not with mailcow. I tested a fresh install of webzash and mailcow. Not a firewall issue. It is a TLS issue.

— Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-1183938873, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULGAD5FS3D67SZZHDKDVT6BQ5ANCNFSM5GKOQ25A . You are receiving this because you were mentioned.Message ID: @.***>

prashants commented 1 year ago

Can you check the .htaccess file. You need to follow some instructions for Lets Encrypt challenge

Uncomment if you have a .well-known directory in the root folder, e.g.

for the Let's Encrypt challenge

https://tools.ietf.org/html/rfc5785

RewriteRule ^(.well-known/.*)$ $1 [L]

On Thu, Jul 14, 2022 at 12:19 PM Prashant Shah @.***> wrote:

Ok. Can you explain your setup a bit like where it is hosted, mailserver, how you are sending email, etc.

You can email me on my personal email id all these details.

On Thu, Jul 14, 2022 at 8:50 AM jessicana @.***> wrote:

I tried that on a fresh install and it did not work with Mailcow. It works with other mailserver but not with mailcow. I tested a fresh install of webzash and mailcow. Not a firewall issue. It is a TLS issue.

— Reply to this email directly, view it on GitHub https://github.com/prashants/webzash/issues/158#issuecomment-1183938873, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQULGAD5FS3D67SZZHDKDVT6BQ5ANCNFSM5GKOQ25A . You are receiving this because you were mentioned.Message ID: @.***>