Operating System - HP-UX
1833403 Members
2873 Online
110052 Solutions
New Discussion

Change SMTP Port for outgoing mail

 
SOLVED
Go to solution
Wilder Mellotto
Frequent Advisor

Change SMTP Port for outgoing mail

Hi, I have a HPUX with Data Protector, and this server was able to send notifications via email.

My unix is configured to connect to my Exchenge server relay.

Problem - the administrator of exchange, change the port 25 to 2525 and my unix server cant reach that port.

telnet 10.0.0.1 25
Trying...
telnet: Unable to connect to remote host: Connection refused

telnet 10.0.0.1 2525
Trying...
Connected to zeus Escape character is '^]'.
220 zeus Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Fri, 19 Jun 2009 10:50:22 -0300

Can I change the unix sendmail.cf to send all mails to port 2525 instead of 25?

Thanks.
4 REPLIES 4
Steven E. Protter
Exalted Contributor
Solution

Re: Change SMTP Port for outgoing mail

Shalom,

http://www.sendmail.org/faq/section3

How do I send using an alternate port?

The port used for outgoing SMTP connections can be changed via the respective *_MAILER_ARGS macros for the various SMTP mailers. In a default configuration, sendmail uses either the relay mailer (for e.g. SMART_HOST when no mailer is specified) or the esmtp mailer (when sending directly to the MX of the recipient domain).

So, if you want all outgoing SMTP connections to use port 2525, you can use this in your .mc file:
define(`RELAY_MAILER_ARGS', `TCP $h 2525') define(`ESMTP_MAILER_ARGS', `TCP $h 2525')

If you want to use an alternate port only for specific destinations, change (e.g.) only the RELAY_MAILER_ARGS, and make sure the relay mailer is not used for anything else. E.g. you can have sendmail use port 2525 only when sending to your domain with this in your .mc file:
FEATURE(`mailertable') define(`confRELAY_MAILER', `esmtp') define(`RELAY_MAILER_ARGS', `TCP $h 2525')

and then in your mailertable:
yourdomain.com relay:mail.yourdomain.com

This will force sendmail to use port 2525 for connections to yourdomain.com. Of course, change 2525 to whatever alternate port number you wish to use.

These are changes to the sendmail.mc file, which has a different filename in HP-UX.

http://www.hpux.ws/buildmail.hpux.text

That script identifies the file names.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Wilder Mellotto
Frequent Advisor

Re: Change SMTP Port for outgoing mail

I added this lines in sendmail.cf

define(`RELAY_MAILER_ARGS', `TCP $h 2525')
define(`ESMTP_MAILER_ARGS', `TCP $h 2525')

When I start sendmail this errors occurs:

/etc/mail/sendmail.cf: line 13: unknown configuration line "define(`RELAY_MAILER_ARGS', `TCP h 2525')"
/etc/mail/sendmail.cf: line 14: unknown configuration line "define(`ESMTP_MAILER_ARGS', `TCP h 2525')"
554 5.0.0 /etc/mail/sendmail.cf: line 13: unknown configuration line "define(`RELAY_MAILER_ARGS', `TCP h 2525')"
554 5.0.0 /etc/mail/sendmail.cf: line 14: unknown configuration line "define(`ESMTP_MAILER_ARGS', `TCP h 2525')"
Steven Schweda
Honored Contributor

Re: Change SMTP Port for outgoing mail

> [...] with this in your .mc file:

> [...] in sendmail.cf

"mc" and "cf" are spelled differently for a
reason.
Wilder Mellotto
Frequent Advisor

Re: Change SMTP Port for outgoing mail

I found a solution

Change /etc/services

smtp 2525/tcp # Simple Mail Transfer Protocol


Change /etc/mail/sendmail.cf

ClientPortOptions=Port=2525,Address=10.0.2.24

Restart sendmail and now its working

Thanks.