From owner-freebsd-questions@FreeBSD.ORG Wed May 16 16:47:17 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EF41D16A400 for ; Wed, 16 May 2007 16:47:16 +0000 (UTC) (envelope-from mailing-lists@msdi.ca) Received: from spamfirewall.msdsky.com (spamfirewall.msdsky.com [64.18.66.8]) by mx1.freebsd.org (Postfix) with ESMTP id ADC6F13C448 for ; Wed, 16 May 2007 16:47:16 +0000 (UTC) (envelope-from mailing-lists@msdi.ca) X-ASG-Debug-ID: 1179334035-472300580000-jLrpzn X-Barracuda-URL: http://spamfirewall.msdsky.com:80/cgi-bin/mark.cgi X-Barracuda-Connect: unknown[64.18.67.9] X-Barracuda-Start-Time: 1179334035 Received: from mail02.msdihosting.net (unknown [64.18.67.9]) by spamfirewall.msdsky.com (Spam Firewall) with ESMTP id 63F775122; Wed, 16 May 2007 12:47:15 -0400 (EDT) Received: from dell390 ([70.83.204.175]) by mail02.msdihosting.net ((iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003))) with ASMTP id QRI44553; Wed, 16 May 2007 12:47:16 -0400 From: "Ian Lord" To: "'Giorgos Keramidas'" References: <00a401c7970d$cf443030$6400a8c0@msdi.local> <20070515212603.GD27529@nemesis.frida.mouhaha.de> <20070515213815.GA45661@gizmo.acns.msu.edu> <20070516071755.GB33559@nemesis.frida.mouhaha.de> <023c01c7978a$cd64e110$6400a8c0@msdi.local> <20070516162217.GB35129@kobe.laptop> X-ASG-Orig-Subj: RE: Newbie Question: Mail from from cron jobs... Date: Wed, 16 May 2007 12:46:31 -0400 Message-ID: <02fe01c797d9$c1f42990$6400a8c0@msdi.local> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 In-Reply-To: <20070516162217.GB35129@kobe.laptop> Thread-Index: AceX1qdcerXtJNKSQ/+ubnVFT4wzKwAAu/3g X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at msdsky.com Cc: freebsd-questions@freebsd.org Subject: RE: Newbie Question: Mail from from cron jobs... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2007 16:47:17 -0000 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 -----Original Message----- From: Giorgos Keramidas [mailto:keramida@ceid.upatras.gr] Sent: 16 mai 2007 12:22 To: Ian Lord Cc: 'Oliver Peter'; 'Jerry McAllister'; freebsd-questions@freebsd.org Subject: Re: Newbie Question: Mail from from cron jobs... On 2007-05-16 03:21, Ian Lord wrote: > -----Original Message----- > From: Oliver Peter [mailto:hoschi@mouhaha.de] > Sent: 16 mai 2007 03:18 > To: Jerry McAllister > Cc: Oliver Peter; Ian Lord; freebsd-questions@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 > root@mydomain.com not root@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 `keramida@ceid.upatras.gr' instead of the default dnl envelope-from of `keramida@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 keramida@ceid.upatras.gr keramida@localhost.laptop keramida@ceid.upatras.gr keramida@kobe keramida@ceid.upatras.gr keramida@kobe.laptop keramida@ceid.upatras.gr root@localhost keramida@ceid.upatras.gr root@localhost.laptop keramida@ceid.upatras.gr root@kobe keramida@ceid.upatras.gr root@kobe.laptop keramida@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