Add mailbox(s), External hosts, Send/Recieve email, Sendmail

Hi

I've read loads on Sendmail but still can't figure this one out. I have users: 1cookie abd admin on my FreeBSD server. Sendmail is my MTA and is up and running. I have MX record entries:

Code:
MX Records
Name			Content				Preference	TTL
myfreebsddomain.org	admin.myfreebsddomain.org	10		3600

From Yahoo I can successfully send an email to 1cookie@myfreebsddomain.org.

mail
Code:
Mail version 8.1 6/6/93.  Type ? for help.
"/var/mail/1cookie": 1 message 1 new
>N  1 myaccount@yahoo.com  Tue Apr 30 03:08  49/3141  "test mail from yahoo"

You would think then that I would be able to send a message to admin@myfreebsddomain.org from my Yahoo account. Well no:

Code:
Sorry, we were unable to deliver your message to the following address.

<admin@myfreebsddomain.org>:
Remote host said: 550 5.1.1 <admin@myfreebsddomain.org>... User unknown [RCPT_TO]

User unknown? admin & 1cookie are both users on my system? Some further investigation:

cat /var/log/maillog | tail
Code:
Apr 30 03:08:19 host sm-mta[56235]: r3U78JxK056234: to=<1cookie@myfreebsddomain.org>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=33049, relay=local, dsn=2.0.0, stat=Sent
Apr 30 04:00:08 host sm-mta[56370]: r3U808fB056370: <admin@myfreebsddomain.org>... User unknown
Apr 30 04:00:08 host sm-mta[56370]: r3U808fB056370: from=<myaccount@yahoo.com>, size=0, class=0, nrcpts=0, proto=ESMTP, daemon=IPv4, relay=nm28.bullet.mail.bf1.yahoo.com [98.139.212.187]
Apr 30 04:05:25 host sm-mta[56383]: r3U85P8s056383: <admin@myfreebsddomain.org>... User unknown
Apr 30 04:05:25 host sm-mta[56383]: r3U85P8s056383: from=<myaccount@yahoo.com>, size=0, class=0, nrcpts=0, proto=SMTP, daemon=IPv4, relay=nm20.bullet.mail.bf1.yahoo.com [98.139.212.179]

Clearly admin exists:

id
Code:
uid=1004(admin) gid=1004(admin) groups=1004(admin),0(wheel)
mail
Code:
No mail for admin

Naturally I've had a look at, even experimented with files/lines from:


/etc/mail/access
/etc/mail/aliases
/etc/mail/local-host-names
/etc/mail/mailer.conf
/etc/mail/mailertable
/etc/mail/virtusertable


I could use some help though as nothing I've tried works thus far. Email from myaccount@yahoo.com to admin@myfreebsddomain.org just bounces.

Code:
Remote host said: 550 5.1.1 <admin@myfreebsddomain.org>... User unknown [RCPT_TO]
 
wblock@ said:
What happens if you try to send mail from another user on the system to admin?

OK, sending a message from 1cookie to admin, both users are on the system.

mail -v -s "Test email from 1cookie" [email]admin@freebsddomain.org[/email]
Code:
hola
.
EOT
admin@freebsddomain.org... Connecting to [127.0.0.1] via relay...
220 my.freebsddomain.org ESMTP Sendmail 8.14.6/8.14.5; Tue, 30 Apr 2013 09:47:44 -0400 (EDT)
>>> EHLO my.freebsddomain.org
250-my.freebsddomain.org Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<1cookie@my.freebsddomain.org> SIZE=62
250 2.1.0 <1cookie@my.freebsddomain.org>... Sender ok
>>> RCPT To:<admin@freebsddomain.org>
>>> DATA
550 5.1.1 <admin@freebsddomain.org>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
/home/1cookie/dead.letter... Saved message in /home/1cookie/dead.letter
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 my.freebsddomain.org closing connection



cat dead.letter
Code:
From 1cookie Tue Apr 30 09:47:44 2013
Return-Path: <1cookie>
Received: (from 1cookie@localhost)
	by my.freebsddomain.org (8.14.6/8.14.5/Submit) id r3UDlib7057127
	for admin@freebsddomain.org; Tue, 30 Apr 2013 09:47:44 -0400 (EDT)
	(envelope-from 1cookie)
Date: Tue, 30 Apr 2013 09:47:44 -0400 (EDT)
From: andy cookson <1cookie>
Message-Id: <201304301347.r3UDlib7057127@my.freebsddomain.org>
To: admin@freebsddomain.org
Subject: Test email from 1cookie

hola

And just to reinforce everything user 1cookie exists:

id
Code:
uid=1003(1cookie) gid=1003(1cookie) groups=1003(1cookie),0(wheel)
 
wblock@ said:
Does admin have a file in /var/mail?

Logged in as admin:

cd /var/mail
ls
Code:
1cookie	admin	ftp	mysql	root	tqadmin	www

cat admin reveals nothing. Must be empty.

ls -l
Code:
total 532
-rw-------  1 1cookie  1cookie    3151 Apr 30 03:18 1cookie
-rw-------  1 admin    admin         0 Apr 27 08:51 admin
-rw-------  1 ftp      ftp           0 Jul  1  2012 ftp
-rw-------  1 mysql    mysql         0 May  9  2012 mysql
-rw-------  1 root     wheel    415898 Apr 30 02:01 root
-rw-------  1 1001     1001          0 Jan 30  2012 tqadmin
-rw-------  1 www      www       96563 Apr 21 08:59 www
 
wblock@ said:
Is there a .forward or some other strangeness in admin's home directory?

Logged in as admin and stood in /home/admin.

ls -a
Code:
.		.cshrc		.login_conf	.mailrc		.rhosts
..		.login		.mail_aliases	.profile	.shrc

cat .mail_aliases
Code:
# $FreeBSD: release/9.0.0/share/skel/dot.mail_aliases 120555 2003-09-28 16:17:30Z rwatson $
#
# .mail_aliases - private mail aliases
#
# see also mail(1)
#

# FreeBSD Mailing lists aliases
# alias freebsd-bugs freebsd-bugs@FreeBSD.org
# alias freebsd-questions freebsd-questions@FreeBSD.org

# an alias for your good friends
# alias bicycle  christoph gerhardt velophil zentralrad


cat .mailrc
Code:
# $FreeBSD: release/9.0.0/share/skel/dot.mailrc 50476 1999-08-28 00:22:10Z peter $
#
# .mailrc - mail resources
#
# see also mail(1)
#

set append ask autoprint 
set indentprefix="> "
set PAGER=more
set EDITOR=vi
set VISUAL=vi
set folder=Mail
retain bcc cc date from subject to

# include your private mail aliases
source ~/.mail_aliases

There's nothing interesing about the other dotfiles it would seem.
 
Comparing the permissions and ownership of the ~/mail directories of the two users is the only other thing that comes to mind. How did you create the admin user?
 
wblock@ said:
Comparing the permissions and ownership of the ~/mail directories of the two users is the only other thing that comes to mind. How did you create the admin user?

cd ~/mail
Code:
cd: /home/admin/mail: No such file or directory

Are you referring to:

/var/mail
/var/mail/1cookie
/var/mail/admin
/var/mail/ftp
/var/mail/mysql
/var/mail/root
/var/mail/tqadmin
/var/mail/www
/var/www/freebsddomain/wp-content/plugins/wp-syntax/geshi/geshi/email.php
/var/www/freebsddomain/wp-includes/class-phpmailer.php
/var/www/freebsddomain/wp-mail.php


It's got nothing to do Wordpress is it?

ls -l /var/mail/
Code:
total 548
-rw-------  1 1cookie  1cookie    3151 Apr 30 03:18 1cookie
-rw-------  1 admin    admin         0 Apr 27 08:51 admin
-rw-------  1 ftp      ftp           0 Jul  1  2012 ftp
-rw-------  1 mysql    mysql         0 May  9  2012 mysql
-rw-------  1 root     wheel    428396 Apr 30 11:09 root
-rw-------  1 1001     1001          0 Jan 30  2012 tqadmin
-rw-------  1 www      www       96563 Apr 21 08:59 www
I could be logged in as any user; run the same command and get the same result? No? I created admin using adduser(8).
 
There should be a mail directory in both 1cookie and admin home directories.

Just in case it comes up later: that 1001 for the tqadmin user means that user is not defined in /etc/passwd.
 
wblock@ said:
There should be a mail directory in both 1cookie and admin home directories.

I put a mail directory in both users' (1cookie and admin) $HOME directories. My /etc/mail/access looks like:

Code:
## Examples (commented out for safety)
#From:cyberspammer.com		ERROR:"550 We don't accept mail from spammers"
#From:okay.cyberspammer.com	OK
#Connect:sendmail.org		RELAY
#To:sendmail.org		RELAY
#Connect:128.32			RELAY
#Connect:128.32.2		SKIP
#Connect:IPv6:1:2:3:4:5:6:7	RELAY
#Connect:suspicious.example.com	QUARANTINE:Mail from suspicious host
#Connect:[127.0.0.3]		OK
#Connect:[IPv6:1:2:3:4:5:6:7:8]	OK
admin.myfreebsddomain.org       OK
myaccount@yahoo.com             OK
myfreebsddomain.org		OK

Upon sending a mail from myaccount@yahoo.com to admin@myfreebsddomain.org the email doesn't bounce any more but logged in as admin on my FreeBSD server I still don't see an email from Yahoo?

I can send a message from myaccount@yahoo.com to 1cookie@myfreebsddomain.org -- I can't figure it out?

Do I *have* to configure:


/etc/mail/access
/etc/mail/aliases
/etc/mail/local-host-names
/etc/mail/mailer.conf
/etc/mail/mailertable
/etc/mail/virtusertable


all these files for it to work?
 
The user does not need to be mentioned in access. And after you change that file, it must be rebuilt with make maps.

No, the defaults for all those other files should work as-is. Look in /var/log/maillog to see what happened to that incoming mail.
 
wblock@ said:
The user does not need to be mentioned in access. And after you change that file, it must be rebuilt with make maps.

No, the defaults for all those other files should work as-is. Look in /var/log/maillog to see what happened to that incoming mail.
I've modified /etc/mail/access:
cat /etc/mail/access
Code:
# $FreeBSD: release/9.0.0/etc/mail/access.sample 176353 2008-02-17 05:22:08Z gshapiro $
#
# Mail relay access control list.  Default is to reject mail unless the
# destination is local, or listed in /etc/mail/local-host-names
#

## Examples (commented out for safety)

myaccount@yahoo.com       OK
and re-built it:
cd /etc/mail
make maps
Code:
/usr/sbin/makemap hash access.db < access
chmod 0640 access.db

I now send two messages from myaccount@yahoo.com on May 2 2013 to admin@myfreebsddomain.org and check the logs:
cat /var/log/maillog
Code:
May  2 00:00:00 host newsyslog[62583]: logfile turned over
May  2 06:42:01 host sm-mta[63531]: r42Ag0Pk063531: from=<myaccount@yahoo.com>, size=2777, class=0, nrcpts=1, msgid=<1367491314.37724.YahooMailNeo@host141006.mail.bf1.yahoo.com>, proto=SMTP, daemon=IPv4, relay=nm17.bullet.mail.bf1.yahoo.com [98.139.212.176]
May  2 06:42:01 host sm-mta[63532]: r42Ag0Pk063531: to=root, delay=00:00:01, xdelay=00:00:00, mailer=local, pri=33036, relay=local, dsn=2.0.0, stat=Sent
May  2 06:48:58 host sm-mta[63567]: r42AmvN5063567: from=<myaccount@yahoo.com>, size=2772, class=0, nrcpts=1, msgid=<1367491732.27696.YahooMailNeo@host141006.mail.bf1.yahoo.com>, proto=ESMTP, daemon=IPv4, relay=nm23-vm0.bullet.mail.bf1.yahoo.com [98.139.212.191]
May  2 06:48:58 host sm-mta[63568]: r42AmvN5063567: to=root, delay=00:00:01, xdelay=00:00:00, mailer=local, pri=33040, relay=local, dsn=2.0.0, stat=Sent

Does this mean messages sent from myaccount@yahoo.com to admin@myfreebsddomain.org are being mapped to root instead of admin? Well it would appear so. Logged in as admin
mail
Code:
No mail for admin
And Logged in as 1cookie and su to root
cd /var/mail
# cat root
Code:
From myaccount@yahoo.com Thu May  2 06:42:01 2013
Return-Path: <myaccount@yahoo.com>
Received: from nm17.bullet.mail.bf1.yahoo.com (nm17.bullet.mail.bf1.yahoo.com [9                                     8.139.212.176])
        by my.freebsddomain.org (8.14.6/8.14.5) with SMTP id r42Ag0Pk063531
        for <admin@freebsddomain.org>; Thu, 2 May 2013 06:42:00 -0400 (EDT)
        (envelope-from myaccount@yahoo.com)
Received: from [98.139.212.147] by nm17.bullet.mail.bf1.yahoo.com with NNFMP; 02                                      May 2013 10:41:55 -0000
Received: from [98.139.212.231] by tm4.bullet.mail.bf1.yahoo.com with NNFMP; 02                                      May 2013 10:41:55 -0000
Received: from [127.0.0.1] by omp1040.mail.bf1.yahoo.com with NNFMP; 02 May 2013                                      10:41:55 -0000
X-Yahoo-Newman-Property: ymail-3
X-Yahoo-Newman-Id: 277368.18504.bm@omp1040.mail.bf1.yahoo.com
Received: (qmail 46168 invoked by uid 60001); 2 May 2013 10:41:55 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=13                                     67491314; bh=6AT+zqbcAL8q850DGVwBvds7U92eN0vwJn9BD/zpFr0=; h=X-YMail-OSG:Receive                                     d:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Versi                                     on:Content-Type; b=uk2P4GaMXXrQUs3rUUIBDiT+LofU55AlKjdwh4QZAVXXKxnOSmzSHrizDsQAB                                     c0jwcIX0VHUy9w5a7eGuO6toPEmGadwpVOGdTpAa5gpRVA0iD0J6lEFLjzOq4SQ738Cl0jS6TtRvV0lC                                     20c8gTz1h+lWsY1/OisvTL+mmijG5s=
DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=yahoo.com;
  h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-T                                     o:Subject:To:MIME-Version:Content-Type;
  b=BdeSRT5A4EJAjuN+/uBd/UfKXBSnEkrbKJAUM5dqAuL2etpBNvfzSvVSTZhpmZZphOUYV1IZHIgd                                     9LGQultatgsmG1M3aylO2i83COwiOBJ66d3Bewm2sj5DXe8NdHJVgFeWNNpHd+OUANxKSqNYv35ImWp9                                     4QCVIGcQ2qDGvpA=;
X-YMail-OSG: DApyNhsVM1lxVCO1JCmETV2kVNYfEzvh83reZRdhMTYNi7y
 GWjDKDqogs9wsW7WclMZWPnbG59cIUi269j7dJ9WbCXoJ51aEUzZUItRDahG
 m6pqcal.gjOItcyT2EONCtEXLaCNa9dA5Gprq9yohkbBcH14UEERK2GYhsdy
 8F7a_rbJencez47o_Sv36zWmjjcYvOijXd3Ml2UATu7WHKZTlcbGdZfgM_Jh
 F.JZBAOFQsaBiB7FDw0Vy6L.2Ilq5Df_yvOx7OixpvXAa6HiZLgTXeDZMhCY
 rhV8IeXfcChg0DWGuDtLVpDZP5Fbno_BVIs1YBWTnfIVqWYqsntyn2PXGbZ9
 VUSaTJig.bj1zCEQuAYAbYBsGRdZYJq8R4G5lxcdOoftMl0x01i.wcp4mzIC
 w3f8OE7GMPBi6aR_ECHMuCN8wNxUXZp5hT3vvBkIrLH5zXi_XbjiJfHdlgjK
 hPlp0_xhv72t8P7bnnuF.KlFoP9oiTPEnkDFikQ_T102uXig-
Received: from [77.107.102.93] by web141006.mail.bf1.yahoo.com via HTTP; Thu, 02                                      May 2013 03:41:54 PDT
X-Rocket-MIMEInfo: 002.001,aG9sYQEwAQEBAQ--
X-Mailer: YahooMailWebService/0.8.141.536
Message-ID: <1367491314.37724.YahooMailNeo@web141006.mail.bf1.yahoo.com>
Date: Thu, 2 May 2013 03:41:54 -0700 (PDT)
From: Andrew Cookson <myaccount@yahoo.com>
Reply-To: Andrew Cookson <myaccount@yahoo.com>
Subject: test message from yahoo
To: "admin@freebsddomain.org" <admin@freebsddomain.org>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="1694620066-1113866978-1367491314=                                     :37724"

--1694620066-1113866978-1367491314=:37724
Content-Type: text/plain; charset=us-ascii

hola
--1694620066-1113866978-1367491314=:37724
Content-Type: text/html; charset=us-ascii

<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, n                                     ew york, times, serif;font-size:12pt"><div>hola</div></div></body></html>
--1694620066-1113866978-1367491314=:37724--

From myaccount@yahoo.com Thu May  2 06:48:58 2013
Return-Path: <myaccount@yahoo.com>
Received: from nm23-vm0.bullet.mail.bf1.yahoo.com (nm23-vm0.bullet.mail.bf1.yaho                                     o.com [98.139.212.191])
        by my.freebsddomain.org (8.14.6/8.14.5) with ESMTP id r42AmvN5063567
        for <admin@freebsddomain.org>; Thu, 2 May 2013 06:48:57 -0400 (EDT)
        (envelope-from myaccount@yahoo.com)
Received: from [98.139.212.148] by nm23.bullet.mail.bf1.yahoo.com with NNFMP; 02                                      May 2013 10:48:52 -0000
Received: from [98.139.212.243] by tm5.bullet.mail.bf1.yahoo.com with NNFMP; 02                                      May 2013 10:48:52 -0000
Received: from [127.0.0.1] by omp1052.mail.bf1.yahoo.com with NNFMP; 02 May 2013                                      10:48:52 -0000
X-Yahoo-Newman-Property: ymail-3
X-Yahoo-Newman-Id: 440611.13013.bm@omp1052.mail.bf1.yahoo.com
Received: (qmail 9046 invoked by uid 60001); 2 May 2013 10:48:52 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=13                                     67491732; bh=akzyTTwBjHKTkNKyZ5cGa4fcTLTgG6RLWIrsFrzBSfw=; h=X-YMail-OSG:Receive                                     d:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Versi                                     on:Content-Type; b=r/E/vqu0L3+XaD41X5aQGGpSu5m1gJO4pdW9hX/6M4fUMfJf292Uwsco1lt/v                                     hWvc/xoGMZIaR3+G4YZE/FUPWRuadG3rBmHGLRdqnAt1uhS50fOj4g8hoRnooxexZ+Ora5AXtw5/Ld4Z                                     2pZgBhsKZkkjKEdtrMy67EK0ToDoTY=
DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=yahoo.com;
  h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-T                                     o:Subject:To:MIME-Version:Content-Type;
  b=q0KQwrvITlJdUzv+cUjJHbGQS/DAVB72UHZ4DoUC2PYE44pLnmKI/T2uGG3Wq04qmTSHMZkUKC90                                     Exi5THYjcZKNbeyMmKhNkIqEEK/HAEFJ0k8VY5l/84NGK/f7CX8vLMJEIZ/M1WIvtwwcUe1ux5MYcc0Z                                     x7DLk9h0GpiidMs=;
X-YMail-OSG: 7S3NYAAVM1mQ5NgmhTNYJxo9XtRWjei5Qm6.WMTZD37YHPW
 LvHcxprW0vUqDsKn7B363psE4gPguNs7FPkw3.giS9AFQDtfWQfYyg7p3g4h
 009gMZIeomq2sbpqV_Q66exF2JhJdtfXz3BLxA3sYw.FBaKDZixn44G69hSl
 7HIcqvK2Gvsp8537OVdO0hs40KIoCcup6WIGgVO1yo53Y98y5LhZ8fxgZROu
 JAfLChNQNhgyPk8rDT9YTcGOierVI8vEouO1CnhfK9at2XuW.b5vto0cum8n
 XzKZUUVs0Lpv.oggeD4n3mfbt3QStzLjxwpRKKfnBu0UigYA9Qi09Xf1Nemb
 o__IjA5NxlGHElNZjz.QxyiotnVc3Y4LrqVQzjmkjVTNnYE7ZrxZN4gSm_ck
 dv8378N4re7Hbc9TqHUtej5yPeVGfqRQB.XXR05NLsmq4C8VEMn0yC4J0L7R
 vV6PAvaVQ5K4bFNEJN8qwt_2UGSNTSBRK28M0fonOXS9Ry4Q-
Received: from [77.107.102.93] by web141006.mail.bf1.yahoo.com via HTTP; Thu, 02                                      May 2013 03:48:52 PDT
X-Rocket-MIMEInfo: 002.001,aG9sYQEwAQEBAQ--
X-Mailer: YahooMailWebService/0.8.141.536
Message-ID: <1367491732.27696.YahooMailNeo@web141006.mail.bf1.yahoo.com>
Date: Thu, 2 May 2013 03:48:52 -0700 (PDT)
From: Andrew Cookson <myaccount@yahoo.com>
Reply-To: Andrew Cookson <myaccount@yahoo.com>
Subject: test message from yahoo
To: "admin@freebsddomain.org" <admin@freebsddomain.org>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="1694620066-671191201-1367491732=:                                     27696"

--1694620066-671191201-1367491732=:27696
Content-Type: text/plain; charset=us-ascii

hola
--1694620066-671191201-1367491732=:27696
Content-Type: text/html; charset=us-ascii

<html><body><div style="color:#000; background-color:#fff; font-family:tahoma, n                                     ew york, times, serif;font-size:12pt"><div>hola</div></div></body></html>
--1694620066-671191201-1367491732=:27696--
How are they mapping to root?
 
Don't modify /etc/mail/access. It is not necessary for this, and only adds another complication.

Aliases are created in /etc/mail/aliases. They don't take effect until newaliases(1) is run.
 
wblock@ said:
Don't modify /etc/mail/access. It is not necessary for this, and only adds another complication.

Aliases are created in /etc/mail/aliases. They don't take effect until newaliases(1) is run.

I removed the line from /etc/mail/access. Moreover, it turns out I had a line in /etc/mail/aliases
Code:
# NETWORK OPERATIONS MAILBOX NAMES
abuse:	root
# noc:		root
security:	root
admin:		root

I commented out the
Code:
admin: root
line and it works. I can now send an email from Yahoo to my FreeBSD box (user: admin) joy! Sound advice from start to finish - I can't thank you enough. Thank you. :)
 
Back
Top