Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Newbie Question: Mail from from cron jobs...

1 view
Skip to first unread message

Ian Lord

unread,
May 15, 2007, 12:26:36 PM5/15/07
to
Hi,

Everyday, cron is sending me status reports of jobs it ran.

In my /etc/mail/aliases I configured root: m...@mydomain.com and it works
fine.

The problem, is that the mail is coming from

ro...@localhost.mydomain.com

We have a spamfirewall and it rejects the mail saying localhost.mydomain.com
is invalid.

Where can I change the address ro...@localhost.mydomain.com to
machi...@mydomain.com ?

Thanks a lot

_______________________________________________
freebsd-...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"

Oliver Peter

unread,
May 15, 2007, 5:26:03 PM5/15/07
to

Jerry McAllister

unread,
May 15, 2007, 5:38:15 PM5/15/07
to
On Tue, May 15, 2007 at 11:26:03PM +0200, Oliver Peter wrote:

> On Tue, May 15, 2007 at 12:26:36PM -0400, Ian Lord wrote:
> > ...


> >
> > Where can I change the address ro...@localhost.mydomain.com to
> > machi...@mydomain.com ?

Look in the file /etc/mail/aliases

You can alias root to go to your favorite address.
Don't forget to run newaliases(1) after editing the file.

Of course, doing this will mean that all mail to root will
go to you.

////jerry

>
> Did you set up your hostname correctly in /etc/rc.conf ?
> Furthermore you need to tell your MTA how your hostname is called.
>
> --
> Oliver PETER, email: hos...@mouhaha.de, ICQ# 113969174
> "Worker bees can leave. Even drones can fly away. The Queen is their slave."

Norberto Meijome

unread,
May 15, 2007, 8:54:27 PM5/15/07
to
On Tue, 15 May 2007 12:26:36 -0400
"Ian Lord" <mailin...@msdi.ca> wrote:

[....]


> The problem, is that the mail is coming from
>
> ro...@localhost.mydomain.com
>
> We have a spamfirewall and it rejects the mail saying localhost.mydomain.com
> is invalid.
>
> Where can I change the address ro...@localhost.mydomain.com to
> machi...@mydomain.com ?

Hi Ian,
set your hostname in /etc/rc.conf:

it probably wouldn't hurt either to have name resolution properly setup (either via DNS or hosts file)

B
_________________________
{Beto|Norberto|Numard} Meijome

"He has Van Gogh's ear for music."
Billy Wilder

I speak for myself, not my employer. Contents may be hot. Slippery when wet. Reading disclaimers makes you go blind. Writing them is worse. You have been Warned.

Oliver Peter

unread,
May 16, 2007, 3:17:55 AM5/16/07
to

Ian Lord

unread,
May 16, 2007, 3:21:20 AM5/16/07
to

-----Original Message-----
From: Oliver Peter [mailto:hos...@mouhaha.de]
Sent: 16 mai 2007 03:18
To: Jerry McAllister
Cc: Oliver Peter; Ian Lord; freebsd-...@freebsd.org
Subject: Re: Newbie Question: Mail from from cron jobs...

On Tue, May 15, 2007 at 05:38:15PM -0400, Jerry McAllister wrote:
> On Tue, May 15, 2007 at 11:26:03PM +0200, Oliver Peter wrote:
>
> > On Tue, May 15, 2007 at 12:26:36PM -0400, Ian Lord wrote:
> > > ...
> > >

> > > Where can I change the address ro...@localhost.mydomain.com to
> > > machi...@mydomain.com ?
>

> Look in the file /etc/mail/aliases
>
> You can alias root to go to your favorite address.
> Don't forget to run newaliases(1) after editing the file.
>
> Of course, doing this will mean that all mail to root will
> go to you.

Hhm. I thought the problem was that you would like to change the From:
of those e-mails not the To: ?

--
Oliver PETER, email: hos...@mouhaha.de, ICQ# 113969174
"Worker bees can leave. Even drones can fly away. The Queen is their slave."

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Exactly... I receive the emails since I correctly configured my aliases to
redirect all mails externally...

The problem I have is with the from...

Someone told me to change the hostname in rc.conf, that won't work since I
have 4 machines:

Machine1.mydomain.com
Machine2.mydomain.com
Machine3.mydomain.com
Machine4.mydomain.com

I want the mail from to be
ro...@mydomain.com not ro...@localhost.mydomain.com
...

Not too sure where to look into to fix this

Schiz0

unread,
May 16, 2007, 6:48:05 AM5/16/07
to
On 5/16/07, Ian Lord <mailin...@msdi.ca> wrote:
>
>
> -----Original Message-----
> From: Oliver Peter [mailto:hos...@mouhaha.de]
> Sent: 16 mai 2007 03:18
> To: Jerry McAllister
> Cc: Oliver Peter; Ian Lord; freebsd-...@freebsd.org
> Subject: Re: Newbie Question: Mail from from cron jobs...
>
> On Tue, May 15, 2007 at 05:38:15PM -0400, Jerry McAllister wrote:
> > On Tue, May 15, 2007 at 11:26:03PM +0200, Oliver Peter wrote:
> >
> > > On Tue, May 15, 2007 at 12:26:36PM -0400, Ian Lord wrote:
> > > > ...
> > > >
> > > > Where can I change the address ro...@localhost.mydomain.com to
> > > > machi...@mydomain.com ?
> >
> > Look in the file /etc/mail/aliases
> >
> > You can alias root to go to your favorite address.
> > Don't forget to run newaliases(1) after editing the file.
> >
> > Of course, doing this will mean that all mail to root will
> > go to you.
>
> Hhm. I thought the problem was that you would like to change the From:
> of those e-mails not the To: ?
>
> --
> Oliver PETER, email: hos...@mouhaha.de, ICQ# 113969174
> "Worker bees can leave. Even drones can fly away. The Queen is their slave."
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Exactly... I receive the emails since I correctly configured my aliases to
> redirect all mails externally...
>
> The problem I have is with the from...
>
> Someone told me to change the hostname in rc.conf, that won't work since I
> have 4 machines:
>
> Machine1.mydomain.com
> Machine2.mydomain.com
> Machine3.mydomain.com
> Machine4.mydomain.com
>
> I want the mail from to be
> ro...@mydomain.com not ro...@localhost.mydomain.com
> ...
>
> Not too sure where to look into to fix this
>
> _______________________________________________
> freebsd-...@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"
>

Try checking /etc/rc.conf for your hostname var. Also, /etc/hosts

Giorgos Keramidas

unread,
May 16, 2007, 12:22:18 PM5/16/07
to
On 2007-05-16 03:21, Ian Lord <mailin...@msdi.ca> wrote:
> -----Original Message-----
> From: Oliver Peter [mailto:hos...@mouhaha.de]
> Sent: 16 mai 2007 03:18
> To: Jerry McAllister
> Cc: Oliver Peter; Ian Lord; freebsd-...@freebsd.org
> Subject: Re: Newbie Question: Mail from from cron jobs...
>
> > Look in the file /etc/mail/aliases
> > >
> > > You can alias root to go to your favorite address.
> > > Don't forget to run newaliases(1) after editing the file.
> > >
> > > Of course, doing this will mean that all mail to root will
> > > go to you.
> >
> > Hhm. I thought the problem was that you would like to change the From:
> > of those e-mails not the To: ?
>
> Exactly... I receive the emails since I correctly configured my aliases to
> redirect all mails externally...
>
> The problem I have is with the from...
>
> Someone told me to change the hostname in rc.conf, that won't work since I
> have 4 machines:
>
> Machine1.mydomain.com
> Machine2.mydomain.com
> Machine3.mydomain.com
> Machine4.mydomain.com
>
> I want the mail from to be
> ro...@mydomain.com not ro...@localhost.mydomain.com

You have to enable 'masquerading' and (optionally) `genericstable' for
this sort of email address rewriting to work.

Here's a commented/example sendmail.mc snippet for that:

dnl Address masquerading.
dnl
dnl Making sure that all email that passes through my desktop's
dnl Sendmail installation is masqueraded as coming from
dnl `kobe.laptop', even if its original address is something
dnl slightly different (i.e. `ftp.laptop' or `mail.laptop'), is ok
dnl here. It ensures that address rewriting and translation through
dnl `genericstable' will also work for all `*.laptop' host names.
dnl
dnl To make sure that remote hosts don't get a MAIL FROM address
dnl from a hostname that doesn't resolve, envelope addresses are
dnl masqueraded here too, and then get rewritten by `genericstable'
dnl to real-world addresses.
dnl
MASQUERADE_AS(`kobe.laptop')
FEATURE(`masquerade_entire_domain')
FEATURE(`masquerade_envelope')

dnl Rewriting the envelope-from address of all outgoing messages
dnl through a `genericstable' lookup ensures that envelope-from
dnl addresses seen by relay hosts are real, i.e. have an address
dnl of `kera...@ceid.upatras.gr' instead of the default
dnl envelope-from of `kera...@kobe.laptop' that Sendmail would use.
dnl
dnl This is required some times, to avoid getting bounces for
dnl messages from ISP mail relays that are misconfigured or are too
dnl strict about what can appear in a MAIL FROM command.
dnl
FEATURE(`genericstable', `hash -o /etc/mail/genericstable')
GENERICS_DOMAIN(`kobe.laptop')
FEATURE(`generics_entire_domain')

Here `kobe.laptop' is my laptop's hostname, and I have enabled address
rewriting for some local email addresses by:

% cat /etc/mail/genericstable
#
# Address rewriting of outgoing email messages.
#

keramida@localhost kera...@ceid.upatras.gr
kera...@localhost.laptop kera...@ceid.upatras.gr
keramida@kobe kera...@ceid.upatras.gr
kera...@kobe.laptop kera...@ceid.upatras.gr

root@localhost kera...@ceid.upatras.gr
ro...@localhost.laptop kera...@ceid.upatras.gr
root@kobe kera...@ceid.upatras.gr
ro...@kobe.laptop kera...@ceid.upatras.gr
%

You will have to use a similar setup to change the envelope-from and
header-from address of the outgoing messages your mail server sends.

- Giorgos

Ian Lord

unread,
May 16, 2007, 12:46:31 PM5/16/07
to
Thanks a lot, it works perfectly.

I'm starting to think it was not that much of a newbie question since you
are the first one to give a working answer :)

Thanks again

- Giorgos

_______________________________________________

0 new messages