Discourse not sending mail

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.2.23
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

Hello,

I try to edit discourse config to send email, for now it failed…

here is my /var/www/discourse/config/discourse.conf


# hostname running the forum
hostname = "forum.domain.tld"

# backup hostname mainly for cdn use
backup_hostname =

# address of smtp server used to send emails
smtp_address = localhost

# port of smtp server used to send emails
smtp_port = 25

# domain passed to smtp server
smtp_domain = forum.domain.tld

# username for smtp server
smtp_user_name = reponse

# password for smtp server
smtp_password = xxxxxxxxxxxxxxxxxxxxxx

# smtp authentication mechanism
smtp_authentication = plain

# enable TLS encryption for smtp connections
smtp_enable_start_tls = true

# mode for verifying smtp server certificates
# to disable, set to 'none'
smtp_openssl_verify_mode =

# force implicit TLS as per RFC 8314 3.3
smtp_force_tls = false

The default domain is yuno.domain.tld, I have create a user reponse@forum.domain.tld

I have added pop and pop3 in donvecot protocols and have a hook for this

/etc/yunohost/hooks/conf_regen/80-dovecot_custom_pop

#!/bin/bash

action=$1
pending_dir=$4
dovecot_conf=$pending_dir/../dovecot/etc/dovecot/dovecot.conf

[[ "$action" == "pre" ]] || exit 0
[[ -e $dovecot_conf ]] || exit 0

sed -e 's/protocols = imap sieve/protocols = imap sieve pop3s pop3/' \
    -i $dovecot_conf

In the parameters Admin of Discourse => Mail

reply by email adresse = reponse+%{reply_key}@forum.domain.tld

pop3 polling enabled = ok
pop3 polling ssl = ok
pop3 polling ssl = ok
pop3 polling host = yuno.domaine.tld
pop3 polling port = 995
pop3 polling username = reponse

When I test I have errors and no mail sended…

What’s wrong ??

Started POST "/admin/email/test" for xx.xxx.x.xxx at 2024-07-25 18:21:30 +0000
Processing by Admin::EmailController#test as */*
  Parameters: {"email_address"=>"user1@domain.tld"}
  Rendered layouts/email_template.html.erb (Duration: 0.2ms | Allocations: 22)
Delivered mail 0fcc5171-2aea-420d-8f4b-dab3dc5d9481@forum.domain.tld (13.6ms)
Completed 422 Unprocessable Entity in 79ms (Views: 0.4ms | ActiveRecord: 0.0ms | Allocations: 15869)

Mon serveur YunoHost

Matériel: VPS acheté en ligne
Version de YunoHost: 11.2.23
J’ai accès à mon serveur : En SSH | Par la webadmin
Êtes-vous dans un contexte particulier ou avez-vous effectué des modifications particulières sur votre instance ? : non

Description du problème

Hello,

J’essaie d’éditer les configs de discourse pour envoyer des courriel, pour l’instant cela ne fonctionne pas…

le fichier /var/www/discourse/config/discourse.conf


# hostname running the forum
hostname = "forum.domain.tld"

# backup hostname mainly for cdn use
backup_hostname =

# address of smtp server used to send emails
smtp_address = localhost

# port of smtp server used to send emails
smtp_port = 25

# domain passed to smtp server
smtp_domain = forum.domain.tld

# username for smtp server
smtp_user_name = reponse

# password for smtp server
smtp_password = xxxxxxxxxxxxxxxxxxxxxx

# smtp authentication mechanism
smtp_authentication = plain

# enable TLS encryption for smtp connections
smtp_enable_start_tls = true

# mode for verifying smtp server certificates
# to disable, set to 'none'
smtp_openssl_verify_mode =

# force implicit TLS as per RFC 8314 3.3
smtp_force_tls = false

le domaine par défaut est yuno.domain.tld, j’ai créer un user reponse@forum.domain.tld

J’ai ajouter les protocoles pop et pop3 dans dovecot et créer un hook pour cela

/etc/yunohost/hooks/conf_regen/80-dovecot_custom_pop

#!/bin/bash

action=$1
pending_dir=$4
dovecot_conf=$pending_dir/../dovecot/etc/dovecot/dovecot.conf

[[ "$action" == "pre" ]] || exit 0
[[ -e $dovecot_conf ]] || exit 0

sed -e 's/protocols = imap sieve/protocols = imap sieve pop3s pop3/' \
    -i $dovecot_conf

Dans les paramètres Admin de Discourse => Courriel

reply by email adresse = reponse+%{reply_key}@forum.domain.tld

pop3 polling enabled = ok
pop3 polling ssl = ok
pop3 polling ssl = ok
pop3 polling host = yuno.domaine.tld
pop3 polling port = 995
pop3 polling username = reponse

Quand j’effectue un test, le mail n’est pas envoyé…

Qu’est ce qui cloche mon capitaine ???

Started POST "/admin/email/test" for xx.xxx.x.xxx at 2024-07-25 18:21:30 +0000
Processing by Admin::EmailController#test as */*
  Parameters: {"email_address"=>"user1@domain.tld"}
  Rendered layouts/email_template.html.erb (Duration: 0.2ms | Allocations: 22)
Delivered mail 0fcc5171-2aea-420d-8f4b-dab3dc5d9481@forum.domain.tld (13.6ms)
Completed 422 Unprocessable Entity in 79ms (Views: 0.4ms | ActiveRecord: 0.0ms | Allocations: 15869)

Hi rodinux,

Did you try configuring a regular mail client with that account, and test whether you can send mail?

Is there any info in the mail log?

yes I do, this user can send mails…

I found this this the mail logs

Jul 25 20:31:32 yuno postsrsd[1705366]: srs_forward: <reponse@forum.domain.tld> not rewritten: Domain excluded by policy
Jul 25 20:31:32 yuno postfix/cleanup[1705365]: CFF0120E7E: message-id=<df7863b61bed7810bf2f792aa60b91f6@forum.domain.tld>
Jul 25 20:31:33 yuno postfix/qmgr[1696940]: CFF0120E7E: from=<reponse@forum.domain.tld>, size=624, nrcpt=1 (queue active)

Or when you said a regular mail client you mean a non yunohost user ??

well is working now. my conf is like this…

# address of smtp server used to send emails
smtp_address = domain.tld

# port of smtp server used to send emails
smtp_port = 25

# domain passed to smtp server
smtp_domain = forum.domain.tld

# username for smtp server
smtp_user_name = reponse

# password for smtp server
smtp_password = xxxxxxxxxxxxxxxxxx

# smtp authentication mechanism
smtp_authentication = plain

# enable TLS encryption for smtp connections
smtp_enable_start_tls = true

# mode for verifying smtp server certificates
# to disable, set to 'none'
smtp_openssl_verify_mode =

# force implicit TLS as per RFC 8314 3.3
smtp_force_tls = false

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.