Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

  • 0
unbranched

(Solved) Email doesn't work

Question

Setup:
-Thirtybees 1.1.0 fresh installation
-Ubuntu 20.04
-nginx server (tls v1.2 and 1.3)
-php 7.4
-mariadb
-thirtybees languages: english and spanish

The BO test email never sends, I tried php mail(), smtp mail with different providers... but always fails. The message in red is only "Error: check your configuration". The debug mode doesn't show me any more details about it.
One thing to note: if I intentionally put a wrong password in smtp details, the error message changes (wrong parameter from service, or something similar), so with the correct password my server actually succeeds in reaching the email service.

Normal email sending from the server shell works.
I searched here and on your github, but I don't find anything relevant (maybe only the languages thing of another github issue, but the files are all there) so I wonder why I'm the only one having this problem.

Edited by unbranched

Share this post


Link to post
Share on other sites

14 answers to this question

Recommended Posts

  • 0

Solved.

This has been really tedious, not for first timers...
So in the end looks like TB smtp interface is buggy or doesn't handle passwords with special characters or wathever.

I ended up installing Postfix, configuring it to relay to the smtp mailservice, setting the login details and changing the header to use the correct sender address.
After all this, I select the php mail() option in TB interface and the system still uses postfix smtp conf.

Tested and works.

Share this post


Link to post
Share on other sites
  • 0

Are you leaving "Mail domain name" blank .. Mine works fine without it

Share this post


Link to post
Share on other sites
  • 0

Might there be some type of permission, whitelist, etc you have to set on your server? I had that once.

Share this post


Link to post
Share on other sites
  • 0

@30knees

I'll check again asap, but I'm pretty sure I already have 755 on all folders, and owned by www-data user.

Edit: I confirm this.

Edited by unbranched

Share this post


Link to post
Share on other sites
  • 0

It was thinking more that emails might be blocked by the server administrator, if that's possible in your case.

Share this post


Link to post
Share on other sites
  • 0

I'm the server admin, and I already tested sending emails via shell, just to see if my hosting provider would block some outgoing traffic. They work without any issue.

Share this post


Link to post
Share on other sites
  • 0

I'm getting php errors in nginx:

94123#94123: *30016 FastCGI sent in stderr: "PHP message: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/mysite/classes/ErrorHandler.php on line 181" while reading response header from upstream, client: 83.xx.yy.zz, server: mysite.com, request: "POST /adminurl/ajax.php?rand=1611394623600 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "mysite.com", referrer: "https://mysite.com/adminurl/index.php?controller=AdminEmails&token=04017..."

94123#94123: *30018 FastCGI sent in stderr: "PHP message: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/mysite/classes/ErrorHandler.php on line 181" while reading response header from upstream, client: 83.xx.yy.zz, server: mysite.com, request: "POST /adminurl/ajax.php?rand=1611394693404 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "mysite.com", referrer: "https://mysite.com/adminurl/index.php?controller=AdminProducts&token=2318b..."

Could it be related? Is php 7.4 fully supported?
 

EDIT
Another update:

tried this time on a raspberry in my home, only difference is php 7.3.

-Test email with php mail(): says succesfully sent, but I don't see anything in my webmail inbox...

-Test email with smtp: same red error telling me nothing, like in my original post.

-No php errors in nginx logs.

-Tried then with apache instead of nginx. Same behaviour.

 

I'm starting to think could it be a mariadb issue? I'm almost clueless now, I need help.

 

Edited by unbranched

Share this post


Link to post
Share on other sites
  • 0
3 hours ago, unbranched said:

I'm getting php errors in nginx:


94123#94123: *30016 FastCGI sent in stderr: "PHP message: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/mysite/classes/ErrorHandler.php on line 181" while reading response header from upstream, client: 83.xx.yy.zz, server: mysite.com, request: "POST /adminurl/ajax.php?rand=1611394623600 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "mysite.com", referrer: "https://mysite.com/adminurl/index.php?controller=AdminEmails&token=04017..."

94123#94123: *30018 FastCGI sent in stderr: "PHP message: PHP Notice:  Trying to access array offset on value of type null in /var/www/html/mysite/classes/ErrorHandler.php on line 181" while reading response header from upstream, client: 83.xx.yy.zz, server: mysite.com, request: "POST /adminurl/ajax.php?rand=1611394693404 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "mysite.com", referrer: "https://mysite.com/adminurl/index.php?controller=AdminProducts&token=2318b..."

Could it be related? Is php 7.4 fully supported?

No, it's not related. PHP 7.4 is supported, but there might be some Notices -- that's not error, that's just notice.

3 hours ago, unbranched said:

I'm starting to think could it be a mariadb issue? 

No

You should look at your php configuration. Note that the config is usually different for cli and php-fpm environments. 

Share this post


Link to post
Share on other sites
  • 0

@datakick

Thanks for the infos.

I don't know what to look for: my php config is the default Ubuntu one, with just the recommended settings applied as suggested by thirtybees install docs. See it in attachment.

I also attach my nginx virtual server conf.

Php modules:

# php -m
[PHP Modules]
apc
apcu
bcmath
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

 

nginx php.ini

Edited by unbranched
Added php modules

Share this post


Link to post
Share on other sites
  • 0

Almost solved. Looks like Ubuntu doesn't come by default with sendmail-bin, so installing it the php mail() function works.

This should be added in install docs...

Now, for reasons I'd like to use the smtp email but it still doesn't work. I tried installing msmtp package and configuring it, then sending an email with it via shell works, but via Thirtybees still not.

I wrote this in php.ini:

sendmail_path = "/usr/bin/msmtp -t"
 

with no other params because they're already set in TB interface.

What else should I need?

Share this post


Link to post
Share on other sites
  • 0
On 1/23/2021 at 7:34 PM, unbranched said:

Looks like Ubuntu doesn't come by default with sendmail-bin, so installing it the php mail() function works.

Sendmail is a Mail Transport Agent (MTA), more commonly known as 'Email-Server'. Other choices are Postfix or Qmail.

It's true, Ubuntu doesn't come with a mail server by default while PHP's mail() requires a working email setup. Any functioning email setup should work, though.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...