Problem:Mail Relay - SMTP block by provider - IONOS

Problem

Due to a change in the email provider, it is no longer possible to send mails with alternative or empty sender addresses as usual. To increase security for our customers, an SMTP block has been implemented.
Emails can then only be sent if the sender address has the same domain as the email inbox used.
News from IONOS

Solution

1. Setting up an alternative SMTP server with Mailjet

The following steps must be carried out:
Mailjet Tutorials

  • Register

  • Set up an account

  • Select Transak onsmails

  • Set up permitted sender domains

  • SPF authen fication

The SPF entry for IONOS can be changed automatically by Mailjet at the touch of a button.
Screenshot from 2024-02-13 13-22-49

2. Testing the SMTP Mailjet server with Thunderbird

Note that the sender domain must first be confirmed in Mailjet using SPF authentication. This may take some time until it is valid and marked as green in Mailjet.
A mail (sender) is then sent to any mail address, which serves as a function check.
It should also be noted that the API key (user name) and the secret key (password) are used when sending.

Hint

Only when the mail dispatch from all sender domains authorized under Mailjet is working, next steps should be taken.

3. Configuration under UCS

The following UCR variables are required for a mail relay to work.

ucr info mail/relayhost
mail/relayhost: <empty>
 In the default setting, Postfix creates a direct SMTP connection to the mail server responsible for the domain when an e-mail is sent to a non-local address. This server is determined by querying the MX record in the DNS. Alternatively, a mail relay server can also be used, i.e., a server which receives the mails and takes over their further sending. The server must be entered as a fully qualified domain name(FQDN).
 Categories: service-mail
 Default: (not set)
 Type: str
ucr info mail/relayauth
mail/relayauth: <empty>
 If a mail relay is used (see 'mail/relayhost') and if the relay requires authentication, this option must be enabled. The username and the password for the relay server are configured in the file /etc/postfix/smtp_auth. This is documented in the UCS manual.
 Categories: service-mail
 Default: (not set)
 Type: bool
ucr set mail/relayhost=yourmaildomain.mailjet.com
ucr set mail/relayauth=yes

Via UMC

Search for mail/relay and change the settings.
Screenshot from 2024-02-13 14-20-38

4. Settings for Postfix

The file /etc/postfix/smtp_auth must then be edited as follows:

# smtp.ionos.de firstname.name@Domain:Password

yourmaildomain.mailjet.com API key:Secret key

Finally, the file must be called up so that the changes are applied by Postfix.

postmap /etc/postfix/smtp_auth
Mastodon