Topics

Tribe Support

Tribe Support's Topics

Connor Summeril

Connor Summeril

June 13 2021

Assistance with SMTP Settings

Hello,

I was able to set up my Anahita installation on my cloud machine (Digital Ocean Droplet) and get Nginx configured correctly so that I could see the landing page and see the Admin sign in page.Unfortunately, when I put in my information for an admin account, I get my browser saying the page is not found and no confirmation email is sent. After reading through some support posts I found the exact same behavior described here.

https://www.getanahita.com/topics/169108-no-user-signup-page?permalink=169237

The solution appeared to be changing SMTP settings but I am unsure how to set that up. I have the following as my SMTP settings with my Mailgun account:

   /* Mailer Settings */

   var $mailer = 'smtp';

   var $mailfrom = 'noreply@mail.testopenhmi.com';

   var $fromname = 'Anahita Website';

   var $sendmail = '/usr/sbin/sendmail';

   /* SMTP Settings */

   var $smtp_user = 'postmaster@mail.testopenhmi.com';

   var $smtp_pass = '********************';

   var $smtp_host = 'smtp.mailgun.org';

   var $smtp_secure = 'ssl';

   var $smtp_port = 465;

I have tried a few different configurations, different ports, and different settings for the $mailer variable. None of which seem to work.I am running my server on a Debian 10 system, as far as I could tell it does not come preconfigured with a sendmail binary. I tried installing sendmail and setting up some configuration but went down a path that did not seem correct and never got it working.Any general tips / advice on how to debug this and check errors? I have enabled debugging in my configuration already like this:

   /* Debuging Settings */

   var $debug = 1;

   var $error_reporting = 30719;

I still am not seeing error codes when I do this. Just looking for some help with SMTP and maybe some example configuration settings.Thank you!
One reliable way is to just use the PHP mail function var $mailer = 'mail'; otherwise I suggest that you use an external SMTP service such as Mailgun.

Also, make sure that $client_domain has the full domain value such as https://www.yourdomain.com
I have tried using 'mail' as the $mailer variable. That did not seem to work. I did a a site re-initialization as well after setting that variable but that didn't seem to work either. I always still had the same behavior.

What does using and external SMTP service such as Mail look like? I have a Mailgun account set up and I have input those parameters into the configuration.php what else needs to be done on the system? I'm not looking for exact specifics but I'm missing a step here.

I do a site re-initialization between each configuration change, is there anything more that needs to be done?

Thanks!
Yes, all you need is to add the MailGun credentials to the configuration file so Anahita can send out emails. Then drop the database and redo the site:ini command. Let me know how it goes.
Okay, I have tried with the full domain name.

I've tried the default mailer with "$mailer = 'mail'".

I've tried to input my MailGun credentials.

Each step I've dropped the database and reran the site:init command. I still see the same behavior. After I attempt to sign up as admin, I get redirected to a page my browser says doesn't exist, no mail gets sent, and not account gets created.

Could this be a problem with my OS? I'm using Debian 10 but I don't know what system is standard for Anahita.

Could it be my firewall settings? I currently have the installation on a cloud device and I only allow traffic from my own IP. I doubt that the mail function needs to accept traffic from anywhere on the outside though. Thoughts?
Alright, to be more specific. Do you see the homepage? When you click on the Login button, does it take you to the login page? When you click on the signup link, does it take you to the signup page? The reason I ask is to make sure that your Nginx config is working properly.
By the way, I'm going to make some changes to the first signup workflow this weekend. I will remove the part that mails out a login link for the first super admin and instead log the first-time user in immediately after the signup. It seems like many people are having trouble with this, and it is understandable because it is unclear whether the problem is with either Anahita or server/OS configurations at this stage. I'll tag it as a 4.5.2 release.
Thanks for the quick response!

Yes I do see the home page when I go to the domain.
When I click the login page it sdoes take me to the login page, and I can click the signup link from there as well, which takes me to the admin sign up page.

Here is my Nginx configuration. I have enabled the index.php$args parameter because I've seen that in some other support tickets. Let me know if you see anything out of order:

+++++++++++++++++++++++++++++++++++
server {

index index.php index.html index.htm;

root /home/anahita-admin/openhmi/www/;

server_name testopenhmi.com;

location / {
try_files $uri $uri/ /index.php$args;
}

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}


listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/testopenhmi.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/testopenhmi.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
if ($host = testopenhmi.com) {
return 301 https://$host$request_uri;
} # managed by Certbot


listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

server_name testopenhmi.com;
return 404; # managed by Certbot

}
+++++++++++++++++++++++++

Thank you for letting me know about an update. I'd love to help debug any of this, I'd be happy to give you a cloud instance just like I have and test on. I have a uniform setup script to ensure that my setup is consistent between server nodes. Feel free to DM or email me.
Rastin Mehr liked this
If you can navigate through those pages, it means your Nginx config is working as expected. It seems like the mail function isn't working and it is breaking the application workflow. With the new update, you'll still need to get the mail working, but at least you'll be able to log in.

I'm going to add you to the Anahita project group. I normally post an update and ask the followers to download and test new releases. I'll try to have the new release ready this weekend.
Sounds good thank you! I will certainly test out the new release when it comes.
Rastin Mehr liked this
Connor, I am checking the code and it indeed logs in the first user and super admin to their account. I've only made subtle improvements in the code that I will be pushing to the master branch soon, but the overall logic is the same. I don't think the mail is causing the issue here.

Here is another suggestion. Set these two variables in the configuration.php file:

var $debug = '1';
var $error_reporting = '30719';

this way you can hopefully get some error messages either in the browser or in your server's php_error.log file.
Hi Rastin.

I tried the debug parameters in my configuration. I see that there is a log directory set in my local Anahita installation, but the logs do not get populated. I saw some initial permission issues after enabling the "$error_reporting" variable and was able to resolve by changing the owner of the Anahita space to www-data.

Are you still working on the release to not send an email for the initial admin login? Last time I tried, (this past weekend) I was still unable to login to the admin account.

Thanks!
Connor, I checked the code and we had already implemented the concept of not sending out an email notification for the first user. You can see the code here: https://github.com/anahitasocial/anahita/blob/master/src/components/com_people/controllers/signup.php#L80

In Anahita 4.6.0 we have added a site:signup command which allows signing up the first user from the CLI, rather than the GUI. I think I am going to include it in the Anahita 4.5.2 Birth release. I'll see if I can do it this week and put out an announcement so you can help us with testing.
Most of the time, people encounter problems while installing and configuring Anahita with either file permission or Nginx configuration. You did right, which was trying to get an error message from the system and start resolving the issue from there.
That sounds good thanks for the update!

Powered by Anahita