Skip to content

SMTP internals displayed in UI on SMTP connection error #189

Open
@pboguslawski

Description

@pboguslawski

When non-existing DNS SMTP server name is configured in user/config/plugins/email.yaml i.e.

mailer:
  engine: smtp
  smtp:
    server: nonexisting-server
    port: 25
    encryption: none
    user: null
    password: null
    auth_mode: null
  sendmail:
    bin: '/usr/sbin/sendmail -bs'

and contact form is defined like this

form:
    name: contact-us
    fields:
        name:
            type: text
            label: 'Name'
            placeholder: 'Give name.'
            autocomplete: 'on'
            validate:
                required: true
            maxlength: 255
[...]
buttons:
        submit:
            type: submit
            value: Submit
    process:
        timestamp:
            label: 'Time'
        ip:
            label: 'IP'
        email:
            to:
                - [email protected]
            subject: 'Message from {{ form.value.name|e }}'
            body: '{% include ''forms/data.html.twig'' %}'
        redirect: /thankyoupage

and user/config/system.yaml contains

errors:
  display: 0
  log: true

or

errors:
  display: -1
  log: true

or

errors:
  display: -1
  log: false

then after pressing Submit Grav displays an error in UI with connection error details

Connection could not be established with host "nonexisting-server:25": stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

According to

https://learn.getgrav.org/17/basics/grav-configuration#errors

such internal details should not be displayed in UI when

errors:
  display: 0
  log: true

is set in system.yaml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions