Forem Creators and Builders 🌱

Akhil Naidu
Akhil Naidu

Posted on • Updated on

Resolved: Unable to unset SMTP and configure SMTP properly

Issue of SMTP was resolved and troubleshooting tips are at the bottom of this article; but still unable to reset values through admin panel

Update:

With this PR now you can unset the variables.


Few days ago when Forem introduced SMTP settings in the admin dashboard, I quickly configured it, but later realised that it is still not under functional state for self-hosting Forems.

Now when I was trying to unset these using the admin dashboard I was not able to do it, and some of my Forem community members who registered their account using email were not able to activate their accounts.

So, I would like to know how to resolve these issues.

  1. How to unset SMTP, by force if needed.
  2. Is there a way to activate users from admin panel?

Update

Both the sendgrid and sendinblue SMTP details are working, I confirmed this by using the send_email feature with the admin panel. Also, the during the forget password the user was able to receive a password reset instructions.

Persisting Issues

  1. User was not able to receive any confirmation mail when using the confirm_email feature in the (Solved)
  2. In Authentication and in SMTP, once the value was assigned to a ENV variables(Like configuring, allowed email Domains or SMTP details) admin was not able to reset them to blank. (Need to be Resolved)

How to resolve this issue.

So, the issue can be resolved with one exception of unable to reset the values to "No Value". Like, unfortunately, I was not able to remove the domain restriction in signup.

How SMTP issues can be resolved.

  1. First make sure that your SMTP details are correct. I found this awesome SMTP tester tool during the troubleshooting process of my Forem.
  2. Unset and Re-SET the default_email from the server (cannot be done using Admin panel).
  3. If domain was not authenticated in send-grid, we should create a sender email within send-grid with the same email as of default_email and not as noreply@example.com
  4. But there are some issues with previous users, but new users have no issues; so configuring SMTP as early as possible in Forem Admin setup should be encouraged.

Persisting Issue

  • Resolved *

  • As mentioned above and many times, the admin was not able to undo the changes to no value.

Admin should have the ability to reset the changes he has done. Even though the problem with SMTP was resolved, I cannot remove domain restriction and added gmail as an acceptable domain(which is a bit weird)

Top comments (19)

Collapse
 
ellativity profile image
Ella (she/her/elle) • Edited

SMTP should be fully functional at this point. Did you already refer to the Admin Docs for your set up? Are you seeing any error messages, or are your emails not being received?

There are 2 ways users can join your Forem: sign up or invitation. If you choose invitation you need SMTP to send the invitations; if you choose sign up, but have SMTP settings configured, users will need to confirm their email address to complete their sign up process (they can do this from the sign in page, thanks to this PR). I believe this is the case even if sign up takes place with OAuth, but can't be sure without asking the team.

As you've discovered, if your SMTP settings fail, all those users will be locked out of their accounts until you can fix the settings, because the Forem believes it has sent the emails and is expecting a confirmation. The same goes for any user accounts you may have for your own access, except the First User, so please ensure that you have access to your First User account.

I'm trying to get more info for you about rolling back SMTP settings to revert the email confirmation trigger. In the meantime, maybe we can try to troubleshoot your SMTP settings and get your emails working?

UPDATE: did you already try clearing all the fields in SMTP settings and saving those changes to reset the vars?

Collapse
 
akhil profile image
Akhil Naidu • Edited

Yes, clearing all the fields but after the pressing the update button, they are being reconfigured automatically to the previous values. In a way, I can update my settings to another SMTP settings, but unable to keep any of the SMTP VAR values Blank. Keeping them blank resulting in automatically configured to previous values.

For now, to solve this issue; I added a domain restriction => Which will forces the user to signup using my configured OAUTH(Github and Twitter) by restricting the email signup.

UPDATE:
Also an email-resgistered user (without email verification) can also automatically activate his account, by re-authenticate using his Github or Twitter (If his Github/Twitter account's email address matches with the sign-up email )

Collapse
 
ellativity profile image
Ella (she/her/elle)

Smart thinking on forcing users into OAuth (although I'm still not 100% sure whether that fixes the issue of access - can you confirm if it worked for your users?).

We're looking into the issue you've encountered with removing SMTP settings and will try to get you an answer as soon as possible. Thanks for your patience and persistence, @akhil !

Just out of curiosity, do you know what was it about your SMTP settings that didn't work?

Thread Thread
 
akhil profile image
Akhil Naidu • Edited

I configured an account in this way.

  1. Created with email, but unable to activate the email
  2. So, I re-authenticated it with Github(same email) => With this I was able to login.

But, when if I tried to login using email-id and password; it is asking me to confirm my account.

Thread Thread
 
ellativity profile image
Ella (she/her/elle)

Is it also asking you to confirm your account as user ID 1 or just all other users?

Thread Thread
 
akhil profile image
Akhil Naidu • Edited

Expecting this case, I made one of my Github authenticated accounts as super-admin. So I can safely test this scenario => I notify the status in just a minute.

Update: No issue of authentication with the First User (User ID: 1), I can safely login.

Thread Thread
 
ellativity profile image
Ella (she/her/elle)

Ok, at least that is working as expected! Thanks for confirming :)

Thread Thread
 
akhil profile image
Akhil Naidu

I found the possible issue location, which might give incentives to the dev team. I will also update the post accordingly.

Both the Sendgrid and Sendinblue SMTP details are working, I confirmed this by using the send_email feature within the admin panel(people section). Also, the during the forget password the user was able to receive a password reset instructions.

Thread Thread
 
ellativity profile image
Ella (she/her/elle)

Great to hear that! Looking forward to getting more info on this one from you, and appreciate your perseverance as always!

Thread Thread
 
akhil profile image
Akhil Naidu • Edited

So, the issue was resolved with one exception of unable to reset the values to "No Value". Like, unfortunately, I was not able to remove the domain restriction in signup.

How SMTP issues can be resolved.

  1. Unset and Re-SET the default_email from the server (cannot be done using Admin panel).
  2. If domain was not authenticated in send-grid, we should create a sender email within send-grid with the same email as of default_email and not as noreply@example.com
  3. But there are some issues with previous users, but new users have no issues; so configuring SMTP as early as possible in Forem Admin setup should be encouraged.

Persisting Issue

  • As mentioned above and many times, the admin was not able to undo the changes to no value.

Admin should have the ability to reset the changes he has done. Even though the problem with SMTP was resolved, I cannot remove domain restriction and added gmail as an acceptable domain(which is a bit weird)

Thread Thread
 
ellativity profile image
Ella (she/her/elle)

Thanks for updating this post, @akhil

the admin was not able to undo the changes to no value

there is a current PR for being able to clear the fields for SMTP settings that should help fix some of the issues you're experiencing.

if domain was not authenticated in send-grid, we should create a sender email within send-grid with the same email as of default_email and not as noreply@example.com

Ultimately, we can't account for every possible combination of user error, and our documentation attempts to address the issue of domain authentication for Sendgrid as well as other transactional mail providers. If we create conditional settings for specific email providers, we then take on responsibility for maintenance and upkeep of those settings as email providers change their own protocols. Our roadmap plans to broaden the possible reach of Forem, rather than tailor the product to specific third-party services, so instead we do our best to maintain documentation and continue to urge people to address the docs with their questions.

configuring SMTP as early as possible in Forem Admin setup should be encouraged.

Following the documentation as advised in the repo would lead users to understand the importance of SMTP creation earlier in the process. Maybe we need to push the docs harder so users understand that they should probably read ahead rather than choose their own adventure?

Thread Thread
 
akhil profile image
Akhil Naidu • Edited

Now the PR was merged and the issue was resolved. I also updated the post accordingly.

Thread Thread
 
ellativity profile image
Ella (she/her/elle)

Great news! Glad to hear it's working for you now!

Collapse
 
benjaminb profile image
Benjamin Bilgehan

Unset and Re-SET the default_email from the server (cannot be done using Admin panel).

Can you tell me which file do i need to locate and set this parameter ?

Collapse
 
akhil profile image
Akhil Naidu • Edited

I'm assuming that you are using t2d script or dokku or heroku to run your Forem.

t2d script

Within the script you can see an option Configure ENV variable for an existing app, choose that to enter the ENV_VARIABLE and its VALUE. The ENV_VARIABLE was DEFAULT_EMAIL and the required VALUE was your email-id

Screenshots for more info.

image 01
Here you can add/Update ENV variables, prefer this, so that the script also know about the name of your APP

To react this screenshot, within the automatic setup, first choose Forem => then you can see this.

image 02
With in this image, at the bottom you can see configure ENV variables for an Existing app; If you are using this, the APP NAME should be nforem or forem. If you are not aware of your app name, I would sugggest you go with the previous screenshot.

For more info, you can watch my video, in which, at the end I added one variable.

Dokku

dokku config:set <your-app-name> DEFAULT_EMAIL=admin@example.com

To list the name of your app => dokku config apps:list

If you insatlled Forem via t2d-script, the name of your app was nforem

Heroku

On Heorku, within your app settings you can add ENV variables section, navigate to that place and add the above mentioned ENV_VARIABELS and its respective VALUES.

Collapse
 
benjaminb profile image
Benjamin Bilgehan

this helped me a lot. !!!!

Collapse
 
ecobrett profile image
Brett Bailey

Hi @akhil ,
What if we followed forem.dev/foremteam/self-host-quic... install instructions and did not use t2d script, dokku, or heroku. I have a successful install but need to unset\change the default email I used. I plan to put this install on Google Cloud into production. Before I get too far along in the setup, should I start over and choose a different path or make other actions now to make future admin easier? Thank you.
-Brett

Thread Thread
 
akhil profile image
Akhil Naidu • Edited

As you already have a Forem selfhost, hosted via the official documentation, you can edit your default email from admin panel.

In case, if you are facing any issues, as you are following official documentation; you can always raise your concern via a new post. Te @forem team will try their part to help you.

If you are using #t2d script, then I'll be glad to help youA

Collapse
 
akhil profile image
Akhil Naidu

What about configuring domain sender I'm sendgrid?

In my opinion, rather than using individual sender configuration, verify the entire domain as a trusted sender.