SMTP authentication not functioning for email notifications

I reported this bug

https://jira.astppbilling.org/browse/ASTPPCOM-1385

@sman123 Has email notifications functioned for you?

I filed bug reports for the SMTP method and local sendmail method.

@alpesh.inextrix FYR

I always use postfix but sendmail should work too. I would check var/log/maillog to see if the server is actually trying to send the email.

If it is and getting rejected at the receiving end the log will show that too. In that case you could set up a gmail relay. You would want to remove sendmail and install postfix if you are trying to do that and then google it. You can also often prevent rejection by setting up rDNS to the domain name that matches the server hostname. Again, google is your friend.

You can also just ask chatgpt. I just tried and both answers are bang on.

I am using postfix. The bug report I created is showing a snip from the mail log where it is indicating SMTP is not enabled, however it is.

For using the sendmail method, while Postfix is installed, sendmail is still called up. When using that method, there is no call for sendmail to send anything. That is why I posted this as a bug. I created two bug reports. One for the SMTP issue, and the other for sendmail.

Goolag search is not going to help with this.

You cannot have sendmail server and postfix server running at the same time because they would both be trying to listen on the same port. It’s gotta be either one or the other. I don’t think the OS will let that happen anyways. I believe sendmail client is used for sending only. It is not a process that needs to be running and listening to a port like sendmail server. I would run the following commands just to make sure that is all correct.

systemctl disable sendmail
systemctl stop sendmail
systemctl enable postfix
systemctl restart postfix

I didn’t say I have both running. I said sendmail is still called up when postfix is installed, but postfix is executed in the place of sendmail.

Either way. both methods do not function for me, hence the two bug reports.

Check /var/log/maillog. If you see it getting rejected on the receiving end then ask chatgpt “how do I set up gmail relay on postfix”

If you have 2FA enabled on the gmail account then ask chatgpt “how to create device password on gmail account if 2fa is enabled”.

As I keep mentioning, there is no call to send any mail using the local sendmail method.

Here is the thread I started on that with a link to the bug report included. This thread is for SMTP not functioning

Using the mail command, I am able to successfully send an email so I know postfix is functioning.

Setting up a relay for postfix is not going to work either is the call to send an email from ASTPP is not functioning.

I don’t remember having a problem like that. If it’s like most of your other problems, it probably has something to do with your install again. Maybe you are missing a package. I am not sure what SMTP needs. Maybe php-cli?

At this point , the only difference between my and their install is using the Debian 11 repo for PHP (unless they are now using the Debian repo now since their recent updates), and MariaDB. I am not sure how either of those would affect creating SMTP errors, or not sending email at all.

I see php-cli is already installed, and I would think something in the logs would indicated if that was missing if needed.

For sending out email locally, I was literally watching the maillog to update after creating a new account. I see the system is supposed to send out a welcome email when that happens.

According the the email log in the ASTPP web interface, such an email was sent, but watching the maillog and waiting for an update in the log, that never occurred.

One can also send a Notification email from the home admin page for low, or past due balance. I have tried both SMTP account, and sendmail. Same results.

Addendum @sman123 :slight_smile:

About the SMTP setup in the web GUI.
The documentation is not clear on a proper setup.

However I am seeing a video on setup for Gmail. It is not quite the same as one would think it should be.

I tried doing it the same way for their Gmail example on my own server, but I still got the same result.

Missing packages will often not generate any errors. I would try enable all php debugging and see if you get any useful errors.

/opt/ASTPP/web_interface/astpp/application/config/config.php > $config[‘log_threshold’] = 4

This will cause a date stamped log file to be created at

/opt/ASTPP/web_interface/astpp/application/logs/

which shows all the PHP code being initialized and any errors in that code. This should only be enabled temporarily as the log files are not automatically deleted. There may also be some sensitive information in those files.

Lastly, you can enable php debugging by going to

/opt/ASTPP/web_interface/astpp/index.php

and set define ( 'ENVIRONMENT', 'development' ). This allows you to see the PHP errors in a web browser as they happen instead of just in the log files.

I did recently mention in the thread about the debug thread I created, that despite set to ‘0’ debug logs are still being generated even with the newest code.

The only two errors I am seeing are:

ERROR - 2023-08-25 00:00:34 --> Severity: Notice  --> Undefined index: billseconds /opt/ASTPP/web_interface/astpp/application/models/common_model.php 204
ERROR - 2023-08-25 00:00:34 --> Severity: Notice  --> Trying to access array offset on value of type bool /opt/ASTPP/web_interface/astpp/application/libraries/Usertracking.php 224

In your jira bug report you said you got an error in the ASTPP log that says “Authentication not enabled”. Show us your SMTP setup in the ASTPP UI. Especially the host configuration and port #. If you are using a service like gmail it should be ssl://smtp.googlemail.com using port 465.

The password should be a one time device password obtained on the google end if you have 2FA set up on the google end. Google will only verify that password on the first try and then it doesn’t need it anymore.

Maybe have a look at the CodeIgnitor Email Class documentation and see if you can find any clues in there.

1 Like

Thanks for that CodeIgniter link. While I can see better how they are using a lot of the code in the whole project now, there is no specifics on the correct format for the “smtp_host.” I suspect that could be my problem due to the STMP video they made for version 4 using Gmail.

I am using Port 587 because of using STARTSSL.

This thread is really old but there are some interesting troubleshooting suggestions in there you might want to try and see if they still work.

https://groups.google.com/g/astpp/c/BMT8_QFOgDw

Hi Mark,

Please follow the steps and let me know the output.

Open this file :
/var/www/html/astpp/application/libraries/astpp/email_lib.php
Line No : 258
echo $this->CI->email->print_debugger(); exit;

Remove the comment from this line and put exit.

Then follow the below mention steps

  1. /var/www/html/astpp/application/modules/email/controllers/email.php
  2. comment out the below line.
    exec($command);
  3. then run the below comand in terminal
    cd /var/www/html/astpp/cron/
  4. run below command
    php cron.php BroadcastEmail
  5. And check output it will show you the exact error.

I have only used gmail and I know that works, so as a sanity check I would set up a gmail account and try that.

After spending some time figuring out Gmail’s new method to connect to their mail system, I got it set up and clicked on one of the “Notify” buttons on the main page. The email did go out, but it sent a double email (correction: was emails stuck in the queue).

I also spent some time on that thread you suggested. It is completely outdated. And the output from the php command only returns some output which looks like a curl command was ran.


:/var/www/html/astpp/cron# php cron.php BroadcastEmail
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

Since it is not functioning plain ol’ SMTP, either it is bugged, or I am doing some setting incorrectly.

Since the documentation is devoid of any setting help, I don’t know which.

I think the docs needs to be put on some place where others could contribute.

UPDATE: The notification systems seems to be spamming me at this point.

I have three different accounts set up, and it is sending each account a low balance notification every hour

I finally figured this out searching in the CodeIgniter forum.

In /opt/ASTPP/web_interface/astpp/system/libraries/Email.php there is a setting on about line 41

var $smtp_crypto = " "; // SMTP Encryption. Can be null, tls or ssl.

Since my email server is using STARTTLS, I needed to put “tls” in the quotes, and made sure the account settings in the GUI is using port 587.

Also to @devangn:

Can the documentation be put on some sort of thing like a wiki where others can contribute? Issues like this is nowhere to be found in your documentation, and others cannot help with it.

@KNERD , let me try arrange something.

1 Like

No trying to hijack an apparently fixed issue and thread, but I’m experiencing similar issues with the SMTP config.

All parameters are set (port 465), tried ss://, ttl://, and without them plain SMTP Host. Logs do not show anything. I’m using POSTFIX.

I tried to edit the CodeIgniter file mentioned on this thread :

// var	$mailpath		= "/usr/sbin/sendmail"; // Sendmail path
var	$mailpath		= "/usr/sbin/postfix"; // POSTFIX path
var	$smtp_crypto = "tls"; // SMTP Encryption. Can be null, tls or ssl.

Same results, all my messages status stay at “pending”.

I can mail from this server from other app, without an issue, using Postfix. so Postfix parameters connects properly with the SMTP host, and sends email correctly and without problem. It is just my ASTPP installation not sending messages, and no logs whatsoever (related to mailing).

Is there something else I need to tweak in order to make ASTPP send emails using POSTFIX ? (and log mailing activity properly ?)