Setting up a default postfix sender / using a relay for the MTA

Hey Gang,

So I have setup up an Opensuse as a simple we/application server. It handles requests for various things and will need to send out email on occasion for things like password reset requests, information / warnings etc. etc.

This is a standard OPenSuse 11.x install with defaults so it comes with Postfix as the mta.

I do not want a mail server I just want to send out via my clients mail server which is hosted exchange rackspace, which simply requires SMTP auth to do so.

What would be the proper way to do this so ALL e-mail send from this machine, regardless of account like WWWRun or when logged in and sending from the command line has the same sender all the time.

Thanks in advance for your advice.

It might be easier to run the ssmtp daemon for this rather than figuring out how to get Postfix to do auth. (It can be done, I use it to relay to gmail all the time, but there are a few config items to edit.) Are you perhaps confusing two things, the envelope sender, which will be the account you authenticate with and cannot be changed, or the Sender: and From: lines, which can be faked to be anything you like?

I don’t know if anyone has built a ssmtp openSUSE package. If you know how to compile a package, it should be easy.

Linux.com :: sSMTP: A simple alternative to Sendmail

On 2010-12-17 19:36, FlyingGuy wrote:

> I do not want a mail server I just want to send out via my clients mail
> server which is hosted exchange rackspace, which simply requires SMTP
> auth to do so.

You can set up postfix to relay all mail to that server (with auth, if
needed). Or, you can configure your local applications to send directly to
that server bypassing postfix.

In any case, don’t attemp to remove postfix, as that would cause other
problems.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Yeah not thinking of trying to remove it. So I figured out, at least I think, through yast to tell it the outgoing server and the credentials and that seems to be working. Is there a way to tell it that ANY email leaving this machine will come from info@domain.com?

When a php script is running e-mail the user says WWW Deamon Apache<wwwrun@domain.com or when I am loged in as root, it obvisouly comes from root. So is there an OUTGOING alias file or mapping of some kind that will work facilitate my goal?


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

On 2010-12-18 01:06, FlyingGuy wrote:

> Yeah not thinking of trying to remove it. So I figured out, at least I
> think, through yast to tell it the outgoing server and the credentials
> and that seems to be working. Is there a way to tell it that ANY email
> leaving this machine will come from info@domain.com?

Notice that domain.com is a registered domain, you can not use it unless it
is yours >:-)

> When a php script is running e-mail the user says WWW Deamon
> Apache<wwwrun@domain.com or when I am loged in as root, it obvisouly
> comes from root. So is there an OUTGOING alias file or mapping of some
> kind that will work facilitate my goal?

You can replace any address with another, yes.
Have a look in the directory /etc/postfix, you will see several files with
documentation.

canonical

Typically, one would use the canonical(5) table to replace

login names by Firstname.Lastname, or to clean up

addresses produced by legacy mail systems.

generic

The optional generic(5) table specifies an address mapping

that applies when mail is delivered. This is the opposite

of canonical(5) mapping, which applies when mail is

received.

Typically, one would use the generic(5) table on a system

that does not have a valid Internet domain name and that

uses something like localdomain.local instead. The

generic(5) table is then used by the smtp(8) client to

transform local mail addresses into valid Internet mail

addresses when mail has to be sent across the Internet.

See the EXAMPLE section at the end of this document.

So, this would be the one. The examples say:

his@localdomain.local hisaccount@hisisp.example

her@localdomain.local heraccount@herisp.example

@localdomain.local hisaccount+local@hisisp.example

so you would use:

root info@yourclient.com

More.

sender_canonical

The sender_canonical_maps parameter specifies optional address

mapping lookup tables for envelope and header SENDER addresses.

For example, you want to rewrite the SENDER address user@ugly.domain

to user@pretty.domain, while still being able to send mail to the

RECIPIENT address user@ugly.domain.

See man 5 canonical, /etc/postfix/canonical or

/etc/postfix/sample-canonical.cf for more details

virtual

The optional virtual(5) alias table rewrites recipient

addresses for all local, all virtual, and all remote mail

destinations. This is unlike the aliases(5) table which

is used only for local(8) delivery. Virtual aliasing is

recursive, and is implemented by the Postfix cleanup(8)

daemon before mail is queued.

Virtual aliasing is applied only to recipient envelope

addresses, and does not affect message headers. Use

canonical(5) mapping to rewrite header and envelope

addresses in general.

examples:

postmaster@virtual-alias.domain postmaster

user1@virtual-alias.domain address1

user2@virtual-alias.domain address2, address3

I use it to redirect my external, real, addresses, to internal login names:

user@yourisp.com user

Then, the little known but very usefull “sender_relayhost”, with entries like:

user@yourisp.com [smtp.yourisp.com]

which combined with some config options, is used to send your email to an
external ISP. You could use this one.

Then, I have a Makefile:

all: access.db relay_ccerts.db sasl_passwd.db transport.db
canonical.db relocated.db sender_canonical.db virtual.db
ehlo_discard_words.db sender_relayhost.db generic.db

transport.db: transport
postmap transport

sender_relayhost.db: sender_relayhost
postmap sender_relayhost

virtual.db: virtual
postmap virtual

… etc

So that after changing any one of the map files, I redo the index with one
“make” command.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Carlos,

Muchas gracias mi amigo!

Not just for the solution but for a very cool, compressed and informative rundown on posfix!!

Best Regards for the holidays to you and yours

Bill

On 2010-12-18 18:06, FlyingGuy wrote:

> Best Regards for the holidays to you and yours

Igualmente (same to you) :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)