Skip to main content

Email

Jadu Central can be configured to use an SMTP server to send email. It also includes a Mail service that should be used where ever email is sent in your code, to ensure consistency across the Jadu platform.

Configuration

Configuration within Jadu Central is XML based. The config should look like the following. Out of the box, Jadu provides a mail.xml.example config which will be copied into the same directory as mail.xml when the application is installed.

Example content of mail.xml:

    <?xml version="1.0" encoding="utf-8" ?>
<system xmlns:config="http://www.jadu.co.uk/schema/config">
<type>smtp</type>
<host>localhost</host>
<port>25</port>
<ssl></ssl>
<username></username>
<password></password>
<verify_peer>0</verify_peer>
</system>

After any changes are made to the mail.xml configuration file, the application config cache should be cleared.

Set Reply-Path

This is controlled via a constant, Add the following to the constants.xml config:

    <email_return_path>reply-path@domain.tld</email_return_path>

Set Sender

Same as Reply-Path, but sets the Sender header within the email instead. Add the following to the constants.xml config:

    <email_sender_address>sender@domain.tld</email_sender_address>

Peer verification in SMTP

By default, SMTP transports perform TLS peer verification.

This may cause the following error to appear in logs where a self-signed SSL certificate is in use for the SMTP server:

Unable to connect with STARTTLS: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

This behavior is configurable by defining the VERIFY_PEER element in mail.xml and setting the value to 0.

<system xmlns:config="http://www.jadu.co.uk/schema/config">
<type>smtp</type>
<host>localhost</host>
<port>25</port>
<ssl></ssl>
<username></username>
<password></password>
<verify_peer>0</verify_peer>
</system>

Although it's not recommended to disable this verification for security reasons, it can be useful while developing the application or when using a self-signed certificate.

https://symfony.com/doc/5.4/mailer.html#tls-peer-verification