Configure RT Sendmail to use more than one smtp relay

Hello guys,
I have a situation where I want certain queues to have their own reply address. How do I set this option Set($SendmailPath, /path/msmtp_wrapper) on RT_Siteconfig file to use 2 mailer configurations? I already created the different sets of msmtp_wrapper and msmtp_wrapper.conf working perfectly after testing on commandline. My major issue is how to set RT to use both mailers.

Ideally, I would like to support even more than 2 mailers.

Thank you.

You could try using a tool like Postfix instead of Sendmail to then handle deciding which outgoing SMTP relay to use

Not sure about that, msmtp works fine as it is. My issue is, how do I tell RT to use more than one Mailer, does it have regex option where you can set more than one
Set($SendmailPath,)

Hi,

I think what you are looking for is the “Reply Address” field

  1. Go to located in Admin → Queues → Select
  2. Click on the Queue that you want to configure
  3. Fill in the “Reply Address” field, the email address you want the “From” field to have
  4. Save

This is how I configure, from what email address each queue replies from.

Hello Thanks
I tried this but for some reason, if this is set to a diff address apart from one predefined as RT_Email_addr it does not work.
My scenario is, this is a different Queue, not General, I want my QueueX to use reply address X.

You can apply this to any queue, not just General.

Yes, but it does not actually work. That would have been the quick easy solution AFAIK

In what way does it not work? We do it all the time here.

Before I get to the details, out of curiosity this reply address need to be also configured on smtp relay used by RT, in my case I use msmtp.

Your mail system will need to know about it, otherwise it won’t know where to direct email replies back to in order to get them into RT.

My exact thinking logic, any chance you are using msmtp, for some reason sending mails from non-default account is giving some trouble. Testing on Commandline to ensure msmtp (my RT smtp relay) can actually send emails from the secondary email.

Sorry, we use Exim here.

Okay, let me figure out msmtp multiple accounts configurations then…
Thank you for engaging me, at least now I know it is possible

I managed to fix my msmtp (RT smtp relay) but it seems The sendmail script used by RT (msmtp_wrapper) Set($SendmailPath, /path/msmtp_wrapper) can only support one email address but not 2, could be RT issue does not have the ability to read 2 email address.

Alittle bit of context here, normally according to this RT msmtp configuration doc, the script is set like this

/usr/bin/msmtp -t -C /opt/rt5/etc/msmtp_wrapper.conf -f rtmail@address.com
/usr/bin/logger -t RTmailer -p syslog.info -- CALL /usr/bin/msmtp -nt "$@" RETURNED $?

Now I tried to modify the script to pick the 2 email addresses;

for mail in rtmail@address.com rtreplymail@address.com;
do 
             /usr/bin/msmtp -t -C /opt/rt5/etc/msmtp_wrapper.conf  -f $mail
             /usr/bin/logger -t RTmailer -p syslog.info -- CALL /usr/bin/msmtp -nt "$@" RETURNED $?
done

To my dismay that did not work. I tried switching the email addresses on the original msmtp_wrapper(not the one I modified) and it works with individual email addresses.

Just wanted to point that out, perhaps there’s a way around it someone has figured it out. For now, spinning another RT seems the only option unfortunately

Umm, I might not be understanding what you’re trying to do here, but this appears to be for sending mail out from RT, not getting the replies back in. And you seem to be ignoring the address RT is trying to send to (in the $@ in the original version of that msmtp_wrapper script in the docs) and instead emailing its output back to itself twice with its two reply addresses? Which I assume you’re somehow picking up and pumping into it using rt_mailgate?

I was trying to modify the msmtp ( RT smtp relay ) to use 2 emails. I chnaged context to trying using a different email address for comments on RT, setting this on Comment Adress on RT config and Queue Config does not work. When I set this, my msmtp throws the error

the server sent an invalid reply' exitcode=EX_PROTOCOL

Seems like msmtp can do this: select an smtp provider based on the From address or envelope sender.

From reading your script, it looks like you want to duplicate the message e.g. send a copy from both addresses?

Looks like the script would need to call msmtp with --from=<address> e.g.
/usr/bin/msmtp -t -C /opt/rt5/etc/msmtp_wrapper.conf --from=rtmail@address.com AND your msmtp config should set the from accordingly to use the correct account / smtp relay. (e.g. option 3 below).

From the msmtp docs::

3.3 Choosing an account

There are three ways to choose the account to use.

  1. --account=account
    Use the given account. Command line settings override configuration file settings.
  2. --host=hostname
    Use only the settings from the command line; do not use any configuration file data.
  3. --from=address or --read-envelope-from
    Choose the first account from the system or user configuration file that has a matching envelope-from address as specified by a from command. This works only when neither --account nor --host is used.
    Subadresses are supported. For example, the envelope from address user+detail@example.com will match the account for user@example.com.
    Furthermore, the envelope-from address of the account may be a wildcard pattern. See from.
# Example msmtp configuration:
#
# This file focusses on TLS and authentication. Features not used here include
# logging, timeouts, SOCKS proxies, TLS parameters, Delivery Status Notification
# (DSN) settings, and more.


# Set default values for all following accounts.
defaults

# Use the mail submission port 587 instead of the SMTP port 25.
port 587

# Always use TLS.
tls on

#
# provider1 service
#
account provider1
host smtp.provider1.example
from queue-address@mydomain.com
auth on
user auth-user@provider1.example
password secret123

#
# A second mail address at the same service:
#
account helpdesk : provider1
from helpdesk@mydomain.com

#
# Comments address for queue:
#
account comments : provider1
from helpedesk-comment@mydomain.com

# Another account:
account isp
host mail.isp.example
from support@somedomain.com
auth on
user support@somedomain.com
password ....

# Set a default account
account default : isp