Sendmail Change Relay Port
Sendmail Change Relay Port
mailertable is used to route email. By default, the Sendmail smtp d elivery agents used to relay mail will connect to other host through the standar d SMTP port 25. From the Sendmail FAQ How do I send using an alternate port, we know that it s possible to relay to other port by define the **MAILER_ARGS, howeve r, that will work for all relay. What if we want to relay to one host running SM TP on port 26, and another host running SMTP on port 8825? We can implement this by adding other mailer. Edit /etc/mail/sendmail.cf, Add the following two mailer definition to the enf o f the file #########esmtp on port 26#### Mesmtp26, P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSM TP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h 26 #########esmtp on port 8825#### Mesmtp8825, P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSM TP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h 8825 Here we defined two mailer called esmtp26 and esmtp8825 . What we do here is to copy the definition of the esmtp mailer, give it a new name, and change its argu ment( the A=TCP .. line, the port number is defined after $h ) to use whichever port we want. Now, in mailertable, we can configure email route to use the two mailers like th is. #relay all mail for asia.example.com to srv1.example.com on port 26 asia.example.com esmtp26:[srv1.example.com] #relay all mail for euro.example.com to srv2.example.com on port 8825 euro.example.com esmtp8825:[srv2.example.com] #relay mail for example.org to srv3.example.com on standard port 25 example.org smtp:[srv3.example.com] ################################################################################ #### Re: how-to configure sendmail to relay mail on port other than 25 I found the following works on Red Hat Linux 7.2. I have all e-mail route through a relay server. My ISP also started blocking por t 25 outbound. Inbound is ok, so I can receive e-mail. Just can't send it out on that port. After much research on the web I found there is one small place you need to ente r the port number in /etc/sendmail.cf. It is toward the bottom. Here is the rele vant lines: Mrelay, P=[IPC], F=mDFMuXa8, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=20 40, T=DNS/RFC822/SMTP,
A=TCP $h 587 Note the "587" at the end on the last line. That is the port my mail relay host is listening for my mail on. I changed that, restarted sendmail, and then it all started working. I also need authinfo file setup I believe, here is what I have, this is in /etc/ mail/authinfo: AuthInfo:smtp.myrelayhost.com "U:[email protected]" "P:mypassword" "M:E" Change myrelatehost.com to your mail relay server, and of course mylogin mypassw ord etc to the appropriate values. This may or may not be needed by your relay h ost, I believe this was needed by mine, it was all working so I didn't touch any thing, but I did have the appropriate values in the file. Hope this helps you or anyone else researching this. I originally thought ClientPortOptions let you change the port you connect to, b ut that option seems to be the local port used by sendmail to connect out. NOT t he port on the remote server. Hope this helps anyone else researching this. There were a lot of ideas out ther e but none of them worked until I changed the above single line. Alex K