# Sendmail not sending mail



## pappa_trent (Jul 23, 2010)

I have a FreeBSD 6.3 installation that is currently running sendmail.  I have a very small 3 node domain that is running DNS.  It appears that my DNS forwarding and reverse lookups are resolving correctly.  I am trying to send mail from the box that is running sendmail to an account on another node. So far this is what I have done:
1.) Added an MX record for any mail coming from mydomain.net
1a.) Tested that using Dig and Host commands to verify that the MX record is correct.
2.) Changes the Cwlocalhost entry in the sendmail.cf file to Cwlocalhost mydomain.net
3.) Added the hosts to the locaol_host_names file and uncommented that entry in the sendmail.cf file
4.) Ensured that the hosts entry in the nsswitch.conf file reads :dns files

The output of the mail command is:

```
myhost# mail -v [email]mymailaccount@mydomain.net[/email]
Subject: test
test
.
EOT
[email]mymailaccount@mydomain.net[/email]... Connecting to [127.0.0.1] via relay...
220 myhost.mydomain.net ESMTP Sendmail 8.14.2/8.14.2; Thu, 22 Jul 2010 17:38:34 -0500 (CDT)
>>> EHLO myhost.mydomain.net
250-myhost.mydomain.net Hello localhost.mydomain.net [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:<root@myhost.mydomain.net> SIZE=47
250 2.1.0 <root@myhost.mydomain.net>... Sender ok
>>> RCPT To:<mymailaccount@mydomain.net>
>>> DATA
550 5.1.1 <mymailaccount@mydomain.net>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
>>> RSET
250 2.0.0 Reset state
root... Using cached ESMTP connection to [127.0.0.1] via relay...
>>> MAIL From:<> SIZE=1071
250 2.1.0 <>... Sender ok
>>> RCPT To:<root@myhost.mydomain.net>
>>> DATA
250 2.1.5 <root@myhost.mydomain.net>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 o6MMcYse013041 Message accepted for delivery
root... Sent (o6MMcYse013041 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 myhost.mydomain.net closing connection
```


I have been banging around on Google for more tan a week with no success.  Any help that you can provide would be most appreciated.


----------



## pappa_trent (Jul 23, 2010)

please keep in mind, I have obscured the name of my domain, email account and host name for security purposes.


----------



## lbol (Jul 23, 2010)

You probably need the virtiual_domain feature in sendmail
add the following lines to your sendmail.mc

```
FEATURE(`virtusertable')dnl
VIRTUSERDOMAIN(`mydomain.net')dnl
```
and re-create your sendmail.cf
If you have multiple virtual domains you can consider to use the sendmail's VIRTUSER_DOMAIN_FILE macro. 

Create the virtualusertable in /etc/mail 
This file should contain one line

```
@mydomain.net    %1@myhost.mydomain.net
```

run command `# makemap hash virtusertable <virtusertable` to create the virtusertable database for sendmail


----------



## pappa_trent (Jul 23, 2010)

Created the virtusertable DB, but no luck.

I am a newbie to Sendmail, so I am going to apologize for asking some very basic questions. So far I have edited the sendmail.cf file by hand.  The edits that I have made have been simply uncommenting a line and pointing said line to my domain i.e. the Cwlocal entry has been changed to Cwmydomain.net, and the Dj$w.Foo.COM to Dj$w.mydomain.net.

Shoul I have edited those entries directly, or used the .mc file.  Also, the .mc file is not in the /etc/mail file on my box.  Do you know where it would be located?

Thanks


----------



## wblock@ (Jul 23, 2010)

pappa_trent said:
			
		

> Created the virtusertable DB, but no luck.
> 
> I am a newbie to Sendmail, so I am going to apologize for asking some very basic questions. So far I have edited the sendmail.cf file by hand. ...
> 
> Shoul I have edited those entries directly, or used the .mc file.



Use the .mc file.



> Also, the .mc file is not in the /etc/mail file on my box.  Do you know where it would be located?



The first time you do a make in /etc/mail, it will create a hostname.mc file.  But you should undo whatever changes you made to the .cf files first.


----------



## pappa_trent (Jul 23, 2010)

OK, so I was able to figure out what .mc file to use.  I entered the FAETURE and VIRTUSERDOMAIN commands that were suggested in the .mc file.  When I rerun the make command, my .cf file is only 61 lines long.  Somewhere I am making a mistake and the make is not completing.  I did not have a virtusertable file as suggested, so I created one in the /etc/mail directory with the two lines suggested. I then ran the make command and it created the makemap command and it created the .db file. 
When I run the Make command, it complains about not having the virtusertable file in the /usr/share/sendmail/features/cf directory. So I copied it over. Again, the .cf file only partially creates, as it stops at 61 lines.  Am I missing something?

again, thanks for the patience


----------



## DutchDaemon (Jul 23, 2010)

I advise you to use /usr/src/contrib/sendmail/cf/README for reference about what to put in an .mc file, and what the syntax is. Note VIRTUSER_DOMAIN and VIRTUSER_DOMAIN_FILE.

Start here: [cmd=]less +/^virtusertable /usr/src/contrib/sendmail/cf/README[/cmd]


----------



## lbol (Jul 24, 2010)

pappa_trent said:
			
		

> When I run the Make command, it complains about not having the virtusertable file in the /usr/share/sendmail/features/cf directory. So I copied it over. Again, the .cf file only partially creates, as it stops at 61 lines.  Am I missing something?
> 
> again, thanks for the patience


The macro should be in /usr/share/sendmail/cf/feature 
Are you sure you have the complete set of files and directories in /usr/share/sendmail?


----------

