Friday, May 11, 2007

How to route your outgoing mail through your Internet Service Provider's mail servers

How to route your outgoing mail through your Internet Service Provider's mail servers





Sendmail

Add these lines to your sendmail.mc file:

define(`SMART_HOST',`mail.yourisp.net')dnl <--- Your ISP's mail server name goes here
MASQUERADE_AS(yourisp.net)dnl <--- Your ISP's domain name goes here
FEATURE(`allmasquerade')dnl
FEATURE(`masquerade_envelope')dnl

These instruct Sendmail to direct all outgoing mail through "mail.yourisp.net" or whatever you specify as your outgoing mail server.

The "masquerade_as" setting will change the sender envelope (MAIL FROM: contents, also known as the Envelope Sender) in case your ISP's outgoing server denies outbound mail with different domains in the MAIL FROM: or Envelope Sender line.

Suresh Ramasubramanian has more to say on Sendmail on dial-up lines:

There are a couple of other things if the server's on a dialup (like the ability to queue mail on the local box when offline). I've written a short howto at http://www.hserus.net/dlhowto.html which explains how to configure a linux box to be used on a dialup. The specific page dealing with sendmail config is at http://www.hserus.net/pop_smtp.html.

I'd be honored if this is included in your docs.

Glad to be of some use. Also, sorry for the delays and no, I'm not going to put your email address here just so it can be strip-mined by spammers. :-)




Qmail



Qmail takes explicit routes from the file /var/qmail/control/smtproutes. If your ISP's mail host is smtp.yourisp.net, put in it a line containing

:smtp.yourisp.net

(The part before the colon is the domain to route through that server, with nothing before the colon meaning to make it the default.)

You may also want to put your ISP's domain name into /var/qmail/control/defaulthost so that name appears as the domain part of From: and envelope "mail from" addresses. The defaulthost setting lets you work with mail servers that permit relay based on domain name. You can also control the outgoing domain with environment variables, see the man page for qmail-inject.


Postfix


Add these lines to your mail.cf file:

mydomain = yourisp.net
myorigin = $mydomain
relayhost = mail.yourisp.net

The myorigin parameter specifies the domain that appears in mail that is posted on this machine. The above setting forces it to be the domain name of your ISP instead of the full name of your system, and works with mail servers that permit relay based on domain name (much like Sendmail's Masquerade feature). The relayhost parameter routes all outgoing mail through the mailserver of your ISP.

Postfix has a FAQ which includes how to use it on dial-up connections, http://www.postfix.org/faq.html.




Microsoft Exchange Server

Much of this applies to Exchange Server 5.5 or later. You may need to upgrade older versions, especially to prevent relay theft by spammers.

The Exchange Server Administrator program has a Connections tab that lets you specify how to route mail for specific domains (Message Delivery). It also has a default route. Select "Forward all messages to host:" and type in the name of your Internet provider's outgoing mail server. You can override this rule for specific domains (such as your own).

For specifics see this Exchange Server how-to:
http://support.microsoft.com/default.aspx?scid=/support/Exchange/Content/HowTos/dialupims.asp.

No comments: