Question about using an external SMTP server

We’re tightly controlling port 25 on our site here, so using the local
method for sending email is a no go. I read something about installing
mailgate on the smtp server here, but that has some people… nervous…
My boss seems to think it should be a matter of switching a line or two to
set a smarthost to our smtp server to make it work. So my question is,
without dropping additional software or whatnot on the smtp server… how
can I use an external server for sending mail? What’s the preferred and
correct configuration needed?

We’re tightly controlling port 25 on our site here, so using the local
method for sending email is a no go. I read something about installing
mailgate on the smtp server here, but that has some people… nervous…
My boss seems to think it should be a matter of switching a line or two to
set a smarthost to our smtp server to make it work. So my question is,
without dropping additional software or whatnot on the smtp server… how
can I use an external server for sending mail? What’s the preferred and
correct configuration needed?

put the mailgate in your real smtp server like this, assuming you have one

This is an example from our qmail smtp server

cat ~alias/.qmal-help

|/opt/rt3/bin/rt-mailgate --queue help --action correspond --url
https://rt.example.net 2>/dev/null

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

You should be able to set up postfix using the parameter ‘relayhost’ for
relaying, you can specify a different port if needed. This would allow
you to still use the sendmail commands to send. This is assuming you can
still receive on port 25 for MX deliveries. Otherwise you may have no
choice but to set it up on your real smtp server.

Chris Hall wrote:

ahh, nevermind, I got it…

Set($SMTPServer, ‘##########’);
Set($SMTPFrom , ‘rt@rt.#########.com’);

but now, my question has evolved slightly… email seems to be successfully
sent out, but I get the email saying “reply to this address if you have
questions, etc…” I reply to it, and nothing seems to happen.

I’ve added the following lines to /etc/aliases

rt: "|/opt/rt3/bin/rt-mailgate --queue ‘General’ --action correspond --url
http://rt.###########.com"
rt-comment: “|/opt/rt3/bin/rt-mailgate --queue ‘General’ --action comment
–url http://rt.##########.com”

(obviously w/o the # signs…) but nothing seems to happen when I reply to
the email… any ideas as to why?On Tue, Apr 27, 2010 at 3:37 PM, Curtis Bruneau curtisb@vianet.ca wrote:

You should be able to set up postfix using the parameter ‘relayhost’ for
relaying, you can specify a different port if needed. This would allow you
to still use the sendmail commands to send. This is assuming you can still
receive on port 25 for MX deliveries. Otherwise you may have no choice but
to set it up on your real smtp server.

Chris Hall wrote:

We’re tightly controlling port 25 on our site here, so using the local
method for sending email is a no go. I read something about installing
mailgate on the smtp server here, but that has some people… nervous…
My boss seems to think it should be a matter of switching a line or two to
set a smarthost to our smtp server to make it work. So my question is,
without dropping additional software or whatnot on the smtp server… how
can I use an external server for sending mail? What’s the preferred and
correct configuration needed?


Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Assuming the SMTPFrom setting isn’t overriding the reply addresses
specified in the queue config queue@ queue-comment@ etc. You may need to
rebuild the alias hash with the newaliases command. Are you getting any
bounces from your smtp?

Chris Hall wrote:

well… none yet. I think I see where I’ve mis-stepped. the modifications
to /etc/aliases needs to be ON the SMTP server, not the RT server, is that
correct? and if so, that means I need to install the rt-mailgate on the
SMTP server? If that’s true, could I just copy my rt-mailgate from my bin
dir on the rt server to the SMTP server, or do I really have to go through
the entirety of the installation? …lotsa questions there, sry.On Tue, Apr 27, 2010 at 3:51 PM, Curtis Bruneau curtisb@vianet.ca wrote:

Assuming the SMTPFrom setting isn’t overriding the reply addresses
specified in the queue config queue@ queue-comment@ etc. You may need to
rebuild the alias hash with the newaliases command. Are you getting any
bounces from your smtp?

Chris Hall wrote:

ahh, nevermind, I got it…

Set($SMTPServer, ‘##########’);
Set($SMTPFrom , ‘rt@rt.#########.com’);

but now, my question has evolved slightly… email seems to be successfully
sent out, but I get the email saying “reply to this address if you have
questions, etc…” I reply to it, and nothing seems to happen.

I’ve added the following lines to /etc/aliases

rt: "|/opt/rt3/bin/rt-mailgate --queue ‘General’ --action correspond --url
http://rt.###########.com"
rt-comment: “|/opt/rt3/bin/rt-mailgate --queue ‘General’ --action comment
–url http://rt.##########.com”

(obviously w/o the # signs…) but nothing seems to happen when I reply to
the email… any ideas as to why?

On Tue, Apr 27, 2010 at 3:37 PM, Curtis Bruneau <curtisb@vianet.ca<mailto: curtisb@vianet.ca>> wrote:

You should be able to set up postfix using the parameter
’relayhost’ for relaying, you can specify a different port if
needed. This would allow you to still use the sendmail commands to
send. This is assuming you can still receive on port 25 for MX
deliveries. Otherwise you may have no choice but to set it up on
your real smtp server.

Chris Hall wrote:

   We're tightly controlling port 25 on our site here, so using
   the local method for sending email is a no go.  I read
   something about installing mailgate on the smtp server here,
   but that has some people... nervous....  My boss seems to
   think it should be a matter of switching a line or two to set
   a smarthost to our smtp server to make it work.  So my
   question is, without dropping additional software or whatnot
   on the smtp server... how can I use an external server for
   sending mail?  What's the preferred and correct configuration
   needed?

   Discover RT's hidden secrets with RT Essentials from O'Reilly
   Media.
   Buy a copy at http://rtbook.bestpractical.com

Ideally it would be on the RT server itself. The SMTP relaying and MTA
are technically separate. You can do just local deliveries on the RT
server which accepts port 25 smtp traffic but think of it as the final
relay destination. You would also have to set up the MTA to recognize
the hostname as accepted so it doesn’t try to relay it back out to
relayhost. I think regardless of your $SMTPServer setting if you had RT
server accepting mail you may want to set up relayhost for bounces and such.

For postfix in /etc/postfix/main.cf you should see the following. The my
networks is to ensure that only localhost can relay through it. This
should for the most part be default already assuming the server was set
up with the RT hostname.

myhostname = rt.domain.com
alias_maps = hash:/etc/aliases
mydestination = rt.domain.com, localhost
mynetworks = 127.0.0.0/8

One thing to note; this is the default domain setup. If you hosted
multiple email domains you’d have to look into the virtual domain
settings. This is mostly likely the case on your SMTP as well so simply
doing /etc/aliases may not be good enough unless your default domain is
the same as the RT server.

As for setting it up on your ‘real’ SMTP, you may be able to copy the
perl script but you will most likely still require some of the perl
modules from the ‘make testdeps’. Then again I’ve never tried to do it
before so I’m not really sure what dependencies it has.

Chris Hall wrote:

well… none yet. I think I see where I’ve mis-stepped. the modifications
to /etc/aliases needs to be ON the SMTP server, not the RT server, is that
correct? and if so, that means I need to install the rt-mailgate on the
SMTP server? If that’s true, could I just copy my rt-mailgate from my bin
dir on the rt server to the SMTP server, or do I really have to go through
the entirety of the installation? …lotsa questions there, sry.

rt-mailgate is depending on few perl modules. copy it over and run it
and you will
see the modules you need or open the file to find out. just install
those dependent
perl modules. you have to make sure your smtp server has http(s)
access to your rt

Assuming the SMTPFrom setting isn’t overriding the reply addresses
specified in the queue config queue@ queue-comment@ etc. You may need to
rebuild the alias hash with the newaliases command. Are you getting any
bounces from your smtp?

Chris Hall wrote:

ahh, nevermind, I got it…

Set($SMTPServer, ‘##########’);
Set($SMTPFrom , ‘rt@rt.#########.com’);

but now, my question has evolved slightly… email seems to be
successfully sent out, but I get the email saying “reply to this address if
you have questions, etc…” I reply to it, and nothing seems to happen.

I’ve added the following lines to /etc/aliases

rt: "|/opt/rt3/bin/rt-mailgate --queue ‘General’ --action correspond
–url http://rt.###########.com"
rt-comment: “|/opt/rt3/bin/rt-mailgate --queue ‘General’ --action comment
–url http://rt.##########.com”

(obviously w/o the # signs…) but nothing seems to happen when I reply
to the email… any ideas as to why?

You should be able to set up postfix using the parameter
’relayhost’ for relaying, you can specify a different port if
needed. This would allow you to still use the sendmail commands to
send. This is assuming you can still receive on port 25 for MX
deliveries. Otherwise you may have no choice but to set it up on
your real smtp server.

Chris Hall wrote:

   We're tightly controlling port 25 on our site here, so using
   the local method for sending email is a no go.  I read
   something about installing mailgate on the smtp server here,
   but that has some people... nervous....  My boss seems to
   think it should be a matter of switching a line or two to set
   a smarthost to our smtp server to make it work.  So my
   question is, without dropping additional software or whatnot
   on the smtp server... how can I use an external server for
   sending mail?  What's the preferred and correct configuration
   needed?

   Discover RT's hidden secrets with RT Essentials from O'Reilly
   Media.
   Buy a copy at http://rtbook.bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

ok, turns out I am getting bounced messages… snippet below:

Delivery to the following recipient has been delayed:

rt@rt.#############.com <rt@rt.imctv.com>

Message will be retried for 2 more day(s)

Technical details of temporary failure:
The recipient server did not accept our requests to connect.

(note, replacing my domain w/ #'s in this email only… :slight_smile: )

Postfix seems to be running on the server…

rt:/etc/init.d# ./postfix status
postfix is running.

On the server itself I verified things seem to be working…

echo ‘hello’ | mail -s “Test subject” rt

which created a ticket in general. I got a CC on it, but replying
sends it again into the ether… thinking perhaps it’s a port blockage
perhaps on the rt server?On Tue, Apr 27, 2010 at 4:20 PM, Curtis Bruneau curtisb@vianet.ca wrote:

Ideally it would be on the RT server itself. The SMTP relaying and MTA are
technically separate. You can do just local deliveries on the RT server
which accepts port 25 smtp traffic but think of it as the final relay
destination. You would also have to set up the MTA to recognize the hostname
as accepted so it doesn’t try to relay it back out to relayhost. I think
regardless of your $SMTPServer setting if you had RT server accepting mail
you may want to set up relayhost for bounces and such.

For postfix in /etc/postfix/main.cf you should see the following. The my
networks is to ensure that only localhost can relay through it. This should
for the most part be default already assuming the server was set up with the
RT hostname.

myhostname = rt.domain.com
alias_maps = hash:/etc/aliases
mydestination = rt.domain.com, localhost
mynetworks = 127.0.0.0/8

One thing to note; this is the default domain setup. If you hosted multiple
email domains you’d have to look into the virtual domain settings. This is
mostly likely the case on your SMTP as well so simply doing /etc/aliases may
not be good enough unless your default domain is the same as the RT server.

As for setting it up on your ‘real’ SMTP, you may be able to copy the perl
script but you will most likely still require some of the perl modules from
the ‘make testdeps’. Then again I’ve never tried to do it before so I’m not
really sure what dependencies it has.

Chris Hall wrote:

well… none yet. I think I see where I’ve mis-stepped. the modifications
to /etc/aliases needs to be ON the SMTP server, not the RT server, is that
correct? and if so, that means I need to install the rt-mailgate on the
SMTP server? If that’s true, could I just copy my rt-mailgate from my bin
dir on the rt server to the SMTP server, or do I really have to go through
the entirety of the installation? …lotsa questions there, sry.

On Tue, Apr 27, 2010 at 3:51 PM, Curtis Bruneau <curtisb@vianet.ca<mailto: curtisb@vianet.ca>> wrote:

Assuming the SMTPFrom setting isn’t overriding the reply addresses
specified in the queue config queue@ queue-comment@ etc. You may
need to rebuild the alias hash with the newaliases command. Are
you getting any bounces from your smtp?

Chris Hall wrote:

   ahh, nevermind, I got it...

   Set($SMTPServer, '##########');
   Set($SMTPFrom , 'rt@rt.#########.com');

   but now, my question has evolved slightly.. email seems to be
   successfully sent out, but I get the email saying "reply to
   this address if you have questions, etc..." I reply to it, and
   nothing seems to happen.

   I've added the following lines to /etc/aliases

   rt: "|/opt/rt3/bin/rt-mailgate --queue 'General' --action
   correspond --url http://rt.###########.com"
   rt-comment: "|/opt/rt3/bin/rt-mailgate --queue 'General'
   --action comment --url http://rt.##########.com"

   (obviously w/o the # signs...) but nothing seems to happen
   when I reply to the email... any ideas as to why?


   On Tue, Apr 27, 2010 at 3:37 PM, Curtis Bruneau <curtisb@vianet.ca <mailto:curtisb@vianet.ca> <mailto:curtisb@vianet.ca <mailto:curtisb@vianet.ca>>> wrote:

      You should be able to set up postfix using the parameter
      'relayhost' for relaying, you can specify a different port if
      needed. This would allow you to still use the sendmail
   commands to
      send. This is assuming you can still receive on port 25 for MX
      deliveries. Otherwise you may have no choice but to set it
   up on
      your real smtp server.

      Chris Hall wrote:

          We're tightly controlling port 25 on our site here, so
   using
          the local method for sending email is a no go.  I read
          something about installing mailgate on the smtp server
   here,
          but that has some people... nervous....  My boss seems to
          think it should be a matter of switching a line or two
   to set
          a smarthost to our smtp server to make it work.  So my
          question is, without dropping additional software or
   whatnot
          on the smtp server... how can I use an external server for
          sending mail?  What's the preferred and correct
   configuration
          needed?

          Discover RT's hidden secrets with RT Essentials from
   O'Reilly
          Media.
          Buy a copy at http://rtbook.bestpractical.com