# Setting up Mail Server



## Lego (Jun 5, 2009)

Ok, I don't really know where to start.  I got my new internet connection today so I can setup my mail server.  I have roundcube installed for checking my mail.  I have imap installed and can log into it with roundcube. I used this link:
http://www.puresimplicity.net/~hemi/freebsd/sendmail.html
now I tried to use the sendmail setup on the same page but when I got to step 4 "make install" I get this error:

```
install -s -o root -g smmsp -m 2555 sendmail /usr/libexec/sendmail
install: sendmail: No such file or directory
*** Error code 71

Stop in /usr/src/usr.sbin/sendmail.
```

Now I also have port 25, 143, 110, 465, 587, 993, 995 forwarded to my server because a few different sites talk about different ports so i figured i would forward them all until i figured out which ones i exactly need.

when I reboot the system I get these errors, and I have the saslauthd_enable & sendmail_enable both set for yes in the rc.conf:

```
Starting sendmail.
Jun 5 17:50:15 blurr-ink sm-mta[1000]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSA: cannot bind: Address already in use
Jun 5 17:50:15 blurr-ink sm-mat[1000]: daemon MSA: problem creating SMTP socket
Starting inetd.
Starting background file system checks in 60 seconds.

Fri Jun 5 17:50:16 EDT 2009
Jun 5 17:50:16 blurr-ink inetd[1051]: pop3s/tcp: bind: Address already in use
Jun 5 17:50:16 blurr-ink inetd[1051]: imaps/tcp: bind: Address already in use
```

In my inetd.conf I have only the imap and pop3 lines un-commented:

```
pop3  stream tcp nowait root /usr/local/libexec/ipop3d  ipop3d
imaps stream tcp nowait root /usr/local/libexec/imapd   imapd
```

In my DNS record I have this for my mail records (I seen it this way on another site when i couldn't get it working....):

```
;MX record (mail server)
IN   MX 10 mx.blurr-ink.com
IN   MX 20 mail.blurr-ink.com
IN   A     216.84.134.244 

;Aliases
mx   IN  A  216.84.134.244 
mail IN  A  216.84.134.244
```

When I do a port scan it says from http://www.t1shopper.com/tools/ it says:

```
216.84.134.244 isn't responding on port 25 (smtp).
216.84.134.244 isn't responding on port 110 (pop3).
216.84.134.244 isn't responding on port 465 (smtps).
216.84.134.244 isn't responding on port 587 (submission).
216.84.134.244 is responding on port 993 (imaps).
216.84.134.244 is responding on port 995 (pop3s).
```

So, I guess Im very lost...If someone could possibly point me in the right direction I would really appreciate it.

Also I changed the Ip of my server today because of the new net connection and it hasn't fully changed over would this make a difference?


----------



## Oko (Jun 6, 2009)

I assume you have a fixed IP address. Do you have reverse DNS?

I am not even getting your post. Are you trying to configure a real mail server?
Who cares about roundcube, IMAP and POP. You have to be firstly able to send and receive the mail directly to your mail server. Actually, as long as you do have proper MX record, static IP and reverse DNS your sendmail server will correctly send mail. It will correctly send e-mail even without static IP, reverse DNS and MX record. The another story is that nobody is crazy enough to receive such an e-mail. 

In reality, you just need to configure sendmail daemon to correctly receive e-mail. There is whole section in the Handbook on that. 

http://www.freebsd.org/doc/en/books/handbook/mail.html

You probably want to configure Clamav and spamassassin before 
you allow your mail server to be on 24/7 because I have a bad feeling that you will become spam zombie and lose your internet service forever.


----------



## Lego (Jun 6, 2009)

what Im trying to do is setup a mail server so I can use email addresses from my site/server. Im running my nameserver/apache for my TLD and want to handle mail aswell. so blurr-ink.com is my website, and my email would be Dan@blurr-ink.com

I did plan on installing both of those programs, but how can someone spam out of my server If im the only person sending emails from it? is that even possible, If i am the only person with an account?? 

Um I didn't have the reverse dns setup, do those entries go in the normal hosts file with the other entries or in a separate file?

My ip isn't static but the lease is long enough that even if i have to reboot the router I keep the same IP. Although, i believe i can request a static ip.

ouch.. ok didn't realize I needed to contact my ISP about it...So it won't work atall until i get that setup?


----------



## dennylin93 (Jun 6, 2009)

Remember NOT TO turn on open relay (or else spammers will be able to use it to send spam).

In /etc/mail/access set the hosts you trust (or just 127.0.0.1).

All the information you need for DNS is probably here: http://www.freebsd.org/doc/en/books/handbook/network-dns.html

The reverse DNS is included in a separate file (similar to the foward DNS).


----------



## DutchDaemon (Jun 6, 2009)

If you want to send email out, use your ISP's mail server, or instruct Sendmail to use your ISP's mail server using the SmartHost directive. Sending mail from a listed/known dynamic IP address will cause your email to not be accepted by a large amount of mail servers using spam filters incorporating blacklists like Spamhaus and many others. Receiving email is another thing; there are dynamic DNS providers that can help you keep your MX records updated after an IP change, or you can script an update of your own DNS records if you have access to your zone files. Don't underestimate running a public mail server (incoming or outgoing) nowadays, there's a lot involved.


----------



## vivek (Jun 6, 2009)

On a related  note, new users may find Postfix as easy to use server. DutchD is right about email servers. Most mail server won't talk to you until and unless you've FQDN that matches your RDNS entry.


----------



## Lego (Jun 6, 2009)

ok, thanks for the info everyone, so is it still fine that im using the FQDN that is the generated one for blurr-ink.com like the ones i've generated? (same ones for webmin and such)

So If i was using my ISP's mail server to send my mail would it still show as coming from say Lego@blurr-ink.com or would it say username@provider.net, And how would i set it up for this?

Also, if I chose that route, how could i configure my server to atleast accept mail for *@blurr-ink.com? because I've not been able to even do that.

this is my access file:

```
cyberspammer.com     505 we do not accept mail from spammers
FREE.STEALTH.MAILER@ 505 we do not accept mail from spammers
127.0.0.1            OK
```

Is that correct? or should they say REJECT?


----------



## DutchDaemon (Jun 6, 2009)

There are basically three kinds of ISPs when it comes to relaying your email:

1. You're in my IP range, go ahead
2. You're in my IP range, but you must use username@provider.domain, screw you and your domain
3. You must authenticate, then you can do whatever you like

You'll have to find out what your ISP is like.

Accepting email is a different subject. You'll have to look into things like /etc/mail/local-host-names, /etc/mail/virtusertable, and many other things. Take a look at /usr/src/contrib/sendmail/cf/README for that kind of stuff.


----------



## Lego (Jun 9, 2009)

well, it turns out my bill is going to double for me to change over to a static IP with reverse DNS setup.  So, I guess, I won't be setting it up just yet. $85CAN.

But, the person I talked to did say I should be able to relay the mail through my providers mail server, only becasue Im a member of that provider.  they gave me the name "out.mnsi.net" or was it "out@mnsi.net" so Im not quite sure how this helps.  but they said it should be recieved by my domain  instead of showing @out.mnsi.net or whatever. so i believe thats the option 1 from your list.

How will I setup my sendmail to relay like this? Then, next would be setting up to recieve mail for my domain, with that ip updates script could I get some help with that. Please.


----------



## DutchDaemon (Jun 9, 2009)

For sending mail through your ISP, see this thread, post #4 and up, for SmartHost'ing. Use 'out.mnsi.net' as the smarthost, and it should work.

If you want to relay mail coming from your LAN, put the IP addresses/range of your LAN in /etc/mail/access with RELAY as the second filed, and run make in /etc/mail. Note, access only supports IP addresses in 'classful form' (123, 123.123, 123.123.123, 123.123.123.123), nothing in between (like 123.123.123.128/25), and no ranges (123.123.123.123-125). See http://www.sendmail.org/documentation/configurationReadme for details.

Use docs at http://www.sendmail.org/documentation/installGuide for further help.

I'm not up to speed with dynamic DNS stuff. There's bound to be stuff in ports for that.


----------



## Lego (Jun 9, 2009)

ok leaving the inbound mail alone for a sec what would you recommend me doing at this point for outbound because I just added the smart host directive line in the blurr-ink.com.mc, make, make install, now I have the sendmail.cf. I restarted sendmail and tried to send out, composed a message with roundcube, but in my root mail box I keep getting postmaster messages for hotmail and yahoo not accepting mail.. so something has to be setup wrong still.


----------



## DutchDaemon (Jun 9, 2009)

/var/log/maillog should give you some ideas. Did the mail actually get sent to your ISP? What's the error message from Yahoo/Hotmail? Is your From address correct? Stuff like that.


----------



## Lego (Jun 10, 2009)

um yes most of it looks correct I guess, here let me show you.
just sent another message to both my email address one at yahoo the other at hotmail, sent with webmin. now i noticed it says send from localhost.blurr-ink.com instead of lego@blurr-ink.com is that an issue?
recieved this in root mailbox:

```
From 	Mail Delivery Subsystem <MAILER-DAEMON>
To 	postmaster
Date 	Tue, 9 Jun 2009 19:23:13 -0400 (EDT)
Subject 	Postmaster notify: see transcript for details
```


```
The original message was received at Tue, 9 Jun 2009 19:16:52 -0400 (EDT)
from localhost.blurr-ink.com [127.0.0.1]

   ----- The following addresses had permanent fatal errors -----
<champagne_dan@hotmail.com>
    (reason: 550 DY-001 Mail rejected by Windows Live Hotmail for policy reasons.
We generally do not accept emai...l/network admins, please visit http://postmaster.live.com
for email delivery information and support)

   ----- Transcript of session follows -----
... while talking to mx3.hotmail.com.:
>>> MAIL From:<Lego@blurr-ink.com> SIZE=661
<<< 550 DY-001 Mail rejected by Windows Live Hotmail for policy reasons. We generally
do not accept email from dynamic IP's as they are not typically used to deliver unauthenticated
SMTP e-mail to an Internet mail server. http://www.spamhaus.org maintains lists of
dynamic and residential IP addresses. If you are not an email/network admin please
contact your E-mail/Internet Service Provider for help. Email/network admins, please
visit http://postmaster.live.com for email delivery information and support
554 5.0.0 Service unavailable
... while talking to b.mx.mail.yahoo.com.:
<<< 553 Mail from 216.8.134.244 not allowed - 5.7.1 [BL21] Connections not accepted
from IP addresses on Spamhaus PBL; see http://postmaster.yahoo.com/550-bl21.html
[550]
... while talking to f.mx.mail.yahoo.com.:
<<< 553 5.7.1 [BL21] Connections not accepted from 216.8.134.244 due to being on
Spamhaus; see http://postmaster.yahoo.com/550-bl23.html
451 4.4.1 reply: read error from a.mx.mail.yahoo.com.
... while talking to c.mx.mail.yahoo.com.:
<<< 553 Mail from 216.8.134.244 not allowed - 5.7.1 [BL21] Connections not accepted
from IP addresses on Spamhaus PBL; see http://postmaster.yahoo.com/550-bl21.html
[550]
... while talking to d.mx.mail.yahoo.com.:
<<< 553 Mail from 216.8.134.244 not allowed - 5.7.1 [BL21] Connections not accepted
from IP addresses on Spamhaus PBL; see http://postmaster.yahoo.com/550-bl21.html
[550]
... while talking to g.mx.mail.yahoo.com.:
<<< 553 Mail from 216.8.134.244 not allowed - 5.7.1 [BL21] Connections not accepted
from IP addresses on Spamhaus PBL; see http://postmaster.yahoo.com/550-bl21.html
[550]
451 4.4.1 reply: read error from e.mx.mail.yahoo.com.
<champagne_dan@yahoo.ca>... Deferred: Name server: e.mx.mail.yahoo.com.: host name
lookup failure
550 5.1.1 <Lego@blurr-ink.com>... User unknown
```

Also, I was just looking at my Security run output, and found this:

```
Checking setuid files and devices:

Checking for uids of 0:
root 0
toor 0

Checking for passwordless accounts:

Checking login.conf permissions:

blurr-ink.com kernel log messages:
+++ /tmp/security.bLhuET5m	2009-06-09 03:01:12.000000000 -0400
+ral0: link state changed to DOWN
+ral0: link state changed to UP

blurr-ink.com login failures:
Jun  8 06:10:04 blurr-ink sshd[58448]: Invalid user admin from 209.55.103.88
Jun  8 06:10:07 blurr-ink sshd[58452]: Invalid user stud from 209.55.103.88
Jun  8 06:10:08 blurr-ink sshd[58454]: Invalid user trash from 209.55.103.88
Jun  8 06:10:10 blurr-ink sshd[58456]: Invalid user aaron from 209.55.103.88
Jun  8 06:10:11 blurr-ink sshd[58458]: Invalid user gt05 from 209.55.103.88
Jun  8 06:10:12 blurr-ink sshd[58460]: Invalid user william from 209.55.103.88
Jun  8 06:10:14 blurr-ink sshd[58462]: Invalid user stephanie from 209.55.103.88
Jun  8 06:10:22 blurr-ink sshd[58474]: Invalid user gary from 209.55.103.88
Jun  8 06:10:25 blurr-ink sshd[58478]: Invalid user guest from 209.55.103.88
Jun  8 06:10:26 blurr-ink sshd[58480]: Invalid user test from 209.55.103.88
Jun  8 06:10:27 blurr-ink sshd[58482]: Invalid user oracle from 209.55.103.88
Jun  8 18:02:36 blurr-ink sshd[68932]: Invalid user oracle from 211.38.137.44
Jun  8 18:02:39 blurr-ink sshd[68934]: Invalid user test from 211.38.137.44

blurr-ink.com refused connections:

-- End of security output --
```

Is that someone trying to hack my ssh??


----------



## Lego (Jun 10, 2009)

oh and here is my tail /var/log/maillog:

```
blurr-ink# tail /var/log/maillog
Jun  9 19:14:37 blurr-ink sendmail[5342]: n59NEbCu005342: <Lego@blurr-ink.com>... User unknown
Jun  9 19:14:37 blurr-ink sendmail[5342]: n59NEbCu005342: from=<champagne_dan@yahoo.ca>, size=0, class=0, nrcpts=0, proto=SMTP, daemon=IPv4, relay=web53201.mail.re2.yahoo.com [206.190.49.71]
Jun  9 19:15:20 blurr-ink imapd[5346]: Login user=Lego host=dyn216-8-134-244.ADSL.mnsi.net [216.8.134.244]
Jun  9 19:15:20 blurr-ink imapd[5346]: Logout user=Lego host=dyn216-8-134-244.ADSL.mnsi.net [216.8.134.244]
Jun  9 19:16:20 blurr-ink imapd[5368]: Login user=Lego host=dyn216-8-134-244.ADSL.mnsi.net [216.8.134.244]
Jun  9 19:16:20 blurr-ink imapd[5368]: Logout user=Lego host=dyn216-8-134-244.ADSL.mnsi.net [216.8.134.244]
Jun  9 19:16:52 blurr-ink sendmail[5371]: n59NGqbM005371: from=Lego@blurr-ink.com, size=491, class=0, nrcpts=2, msgid=<1244589412.5369@blurr-ink.com>, relay=root@localhost
Jun  9 19:16:52 blurr-ink sm-mta[5372]: n59NGqej005372: from=<Lego@blurr-ink.com>, size=661, class=0, nrcpts=2, msgid=<1244589412.5369@blurr-ink.com>, proto=ESMTP, daemon=Daemon0, relay=localhost.blurr-ink.com [127.0.0.1]
Jun  9 19:16:52 blurr-ink sendmail[5371]: n59NGqbM005371: to=champagne_dan@hotmail.com,champagne_dan@yahoo.ca, ctladdr=Lego@blurr-ink.com (1001/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60491, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (n59NGqej005372 Message accepted for delivery)
Jun  9 19:16:53 blurr-ink sm-mta[5374]: n59NGqej005372: to=<champagne_dan@hotmail.com>, delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=60661, relay=mx3.hotmail.com. [65.54.244.200], dsn=5.0.0, stat=Service unavailable
blurr-ink#
```


----------



## DutchDaemon (Jun 10, 2009)

Yes, people will always try to hack your sshd. Welcome to the net. See http://forums.freebsd.org/showthread.php?t=4108 for tips.

Your mail is not going through your ISP's mail server, so it gets rejected because it comes from your dynamic IP address. Look into the smarthost stuff again. It should show up in sendmail.cf as "DSout.mnsi.net" if you did it right.


----------



## Lego (Jun 10, 2009)

Ok, this is ridiculous.  I think I'm going to change the port which ssh connects on because I just checked the security run for yesterday/last night, whichever it is, and I have had an insane amount of log attempts. Thanks for that link with the security info.  And I'll look into the SmartHost again, and get back to ya, Thanks. How would I add the mail as an attachment to my post, because I can't find the actual document in my /var/mail folder.  I just wanted to add it and show you the like 500+ log attempts.
about 250 like this:

```
[212.154.32.188] failed - POSSIBLE BREAK-IN ATTEMPT!
Jun  9 18:07:12 blurr-ink sshd[3992]: Invalid user ftpuser from 212.154.32.188
```
another 250 or so like this:

```
Jun  9 12:36:10 blurr-ink sshd[86692]: Invalid user nagios from 213.159.6.144
```
and 3 like this:

```
Jun  9 09:58:46 blurr-ink proftpd[83436]: localhost.blurr-ink.com (www.eclic-visio.com[88.191.61.58])
- USER mysql (Login failed): Incorrect password.
```

I tried to track the IP like I did that other ones, but these come up with nothing but question marks.


----------



## Lego (Jun 10, 2009)

I guess its a good thing I have some very secure passwords eh?


----------



## DutchDaemon (Jun 10, 2009)

Not only very secure passwords (or only ssh keys in the case of sshd), but 'unusual' usernames as well. Anything straight out of a dictionary, or almost any conceivable first or last name, animal name, vegetable, fruit, and possibly insect, is in every rainbow table out there.


----------



## Lego (Jun 10, 2009)

hmm.. well my passwords all incorporates numbers, letters, and special characters, as for my usernames those vary from item to item.. like my username for webmin is different then the system, and different from mysql, and so on.. so if someone manages to get 1 username/password match, thats the only thing its good for. and none of the usernames/passwords incorporate my real name or screen name.

Is it 'wrong' to contact the provider of the IP and tell them that someone in there service has been attempting to hack my server? because Im sure they have records of who has been issued what IP, correct? And maybe even provide the log of attempts?


----------



## Lego (Jun 11, 2009)

YAY!! I was able to send a message to hotmail after re-reading and doing the process again now I'm just waiting to see if my yahoo account will receive a mail aswell.  *It did, but was sent to the spam mail folder 

Unfortunately, this morning I released my IP and tried to change ports for ssh, but when I edited the sshd_config and un commented the Port line and changed the port number my server wouldn't connect http/ftp/ssh none so i changed it back and rebooted the server again, and its not working again :S.

Now I will probably have to wait until my dns finishing resolving but will my incoming mail just work automatically now?

ssh is working agian.


----------



## DutchDaemon (Jun 11, 2009)

Yes, I think so, but it may be 'by accident'. 

Your server has the same name as your domain, and I guess your email address (the part before @) is also a local mailbox. Your email address is therefore "mailbox@server". That's by far the simplest Sendmail setup there is, and it should work because there's nothing virtual about it. And your MX record is pointing to the IP address of the server, I presume, so you should be good to go for now. 

If you need to handle email for more domains you will have to look into virtusertable and local-host-names. And if you need to receive mail for addresses that are not local mailbox names, aliases can help you out -- though in that case I would go for virtusertable straight away.


----------



## Lego (Jun 11, 2009)

hmm.. well I had setup some of that stuff while I was following a sendmail setup tutorial. how do I stop it from being sent to the yahoo spam folder?
/etc/mail/access

```
cyberspammer.com    505 we do not accept mail from spammers
FREE.STEALTH.MAILER@505 we do not accept mail from spammers
127.0.0.1           OK
```

/etc/mail/aliases is default

/etc/mail/local-host-names

```
blurr-ink.com
```

/etc/mail/mailer.conf is default

/etc/mail/virtusertable

```
root@blurr-ink.com       root
Lego@blurr-ink.com       Lego
admin@blurr-ink.com      Lego
@blurr-ink.com           Lego
```

DNS record:

```
;MX record (mail server)
IN   MX 10 mx.blurr-ink.com
IN   MX 20 mail.blurr-ink.com
IN   A     216.84.134.244 

;Aliases
mx   IN  A  216.84.134.244 
mail IN  A  216.84.134.244
```

Is that all correct? Like in the setup


----------



## DutchDaemon (Jun 12, 2009)

Lego said:
			
		

> /etc/mail/virtusertable
> 
> ```
> root@blurr-ink.com       root
> ...


You can remove the Lego@ and admin@ entries, because the @blurr-ink.com entry already points to mailbox Lego. Note that this creates a 'catch-all' situation. In other words: any email address on your domain is acceptable and will be delivered to your mailbox. If you want to lock down the email addresses you want to handle, lose the @blurr-ink.com line, and only define the exact email addresses you want to accept.


			
				Lego said:
			
		

> DNS record:
> 
> ```
> ;MX record (mail server)
> ...



Having two MX records pointing to the same address does not add any value. Just pick one. Note that you should add the hostname you're using in an MX record to local-host-names. RFCs state that you should have a working postmaster address on any MX hostname. So if you go with mail.blurr-ink.com, add mail.blurr-ink.com to local-host-names, and postmaster@mail.blurr-ink.com to virtusertable.

Note that a change to local-host-names requires a restart of Sendmail, whereas databases like aliases, virtusertable, mailertable etc. require 'make' in /etc/mail.


----------



## Lego (Jun 12, 2009)

ok ok, thanks. so should I leave the blurr-ink.com in the localhosts names and add mx.blurr-ink.com or just have mx.blurr-ink.com?

I will remove the dns entry for mail.blurr-ink.com and just use the mx record.

Add postmaster@mx.blurr-ink.com to virtusertable. then "cd /etc/mail && make" then will I have to copy the blurr-ink.com.cf to sendmail.cf and blurr-ink.com.mc to sendmail.mc again?? then restart sendmail


----------



## DutchDaemon (Jun 12, 2009)

If you're using virtusertable you *must* include all domains and hostnames in local-host-names. Then restart sendmail ([cmd=]/etc/rc.d/sendmail restart[/cmd]). You should also put corresponding entries in virtusertable to handle email addresses under those domains/hostnames.

Changes to any of the tables in /etc/mail (aliases, access, virtusertable, mailertable, etc.) only require you to run 'make' in /etc/mail. You don't need to restart Sendmail for that -- the changes are active right after 'make'.

The only time when sendmail.cf needs to be regenerated is when you actually make changes to Sendmail itself -- i.e. turning on/off certain options, adding/removing plugins like Spamassassin, Milter etc, when changing your server's hostname, when switching to a different smarthost (i.e.: changes to the .mc file), etc.


----------



## Lego (Jun 13, 2009)

ok awesome! lol, I forgot to update my nameserver IP at godaddy so it'll be another day or so before i can try.


----------



## Lego (Jun 13, 2009)

DutchDaemon said:
			
		

> If you're using virtusertable you *must* include all domains and hostnames in local-host-names. Then restart sendmail ([cmd=]/etc/rc.d/sendmail restart[/cmd]). You should also put corresponding entries in virtusertable to handle email addresses under those domains/hostnames.



Wait, ok does that mean all i need in the local-host-names file is mx.blurr-ink.com or mx.blurr-ink.com and blurr-ink.com??  Blurr-ink.com is the only domain and my hostname is set to blurr-ink.com.

----------------------------------------------
Also, I just added the postmaster@mx.blurr-ink.com to the virtusertable:

```
root@blurr-ink.com                   root
@blurr-ink.com                       Lego
postmaster@mx.blurr-ink.com          Lego
```

removed the mail entry from my dns record.
changed my local-host-names file to:

```
blurr-ink.com
mx.blurr-ink.com
```

Ran Make in /etc/mail, and restarted bind & sendmal. and that should be it right? I really do appreciate the help, the mail has been the one thing I haven't been able to get working in any form up until now.

Also, is there anyway I can stop my outgoing mail from ending up in hotmail/yahoo junk/spam box??


----------



## DutchDaemon (Jun 13, 2009)

Your settings in local-host-names and virtusertable are now correct. I have no idea how that spam box stuff works at Hotmail/Yahoo. Isn't there a way to mark those emails as 'not junk' or 'not spam', so the filter will learn not to consider them junk/spam over time?


----------



## Lego (Jun 13, 2009)

hmm.. I think so, I'll check into that.  Again, I can't thank you enough for the help getting this setup correctly.  Now hopefully, by tomorrow my DNS will be finished resolving, and I'll be able to test sending mail back.  Oh, and because I have 127.0.0.1 as the only listed 'OK' in the access file that means nobody can use my mail server to relay and spam out, right?


----------



## DutchDaemon (Jun 13, 2009)

That's right. 

Sendmail won't relay email for anyone by default. Each IP address you want to grant relay possibilities must be put in /etc/mail/access with 'RELAY' as the second field ('OK' means: 'accept email from', 'RELAY' means: 'relay email for'). 

You would typically put the IP addresses of a LAN there. I don't think you will need that 127.0.0.1 line in there, either with OK or RELAY, because Sendmail itself is running there.


----------



## Lego (Jun 13, 2009)

ok, cool. well I'll leave it for now.  But I don't need the LAN IP added right, because Im not relaying.  I just plan on always sending from webmin, or roundcube, and everything is on the same system, so nothing is really getting relayed,  I have been able to send mail from both computers (server and my other system) logged into webmin.

oh and I figured out how to set my mail to not go to the spam box. but Im not sure if that filter will only apply to me or everyone.


----------



## DutchDaemon (Jun 13, 2009)

Correct. If your email originates/gets created on the server itself, no relaying is necessary.


----------



## ph0enix (Jun 19, 2009)

Lego said:
			
		

> what Im trying to do is setup a mail server so I can use email addresses from my site/server. Im running my nameserver/apache for my TLD and want to handle mail aswell. so blurr-ink.com is my website, and my email would be Dan@blurr-ink.com
> 
> I did plan on installing both of those programs, but how can someone spam out of my server If im the only person sending emails from it? is that even possible, If i am the only person with an account??
> 
> ...



If all you need is to be able to send/receive mail to/from @blurr-ink.com, then look into using Google Apps (standard edition).  It's free, reliable and will save you a lot of headache that comes with hosting your own mail server but if you're doing this so you can learn then it's a completely different story.

J.


----------



## Lego (Jun 19, 2009)

Thanks for the reply; yes its more of a learning process, but Also to use it.  I host my ssh, ftp, http, Also have webmin & phpMyAdmin. So why not try and get a mail server running (with roundcube); I don't know, I enjoy having my own personal webspace that I don't have to pay for and can do whatever I want with. And, its a challenge its something I have never done with a computer,  I enjoy expanding my computer knowledge.

What exactly does google apps do?

Either way, I am able to send out now, But for some unknown reason I can't send in yet, i try to reply to the recieved message in yahoo and after a day or so I get this:

```
Hi. This is the qmail-send program at yahoo.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<Lego@blurr-ink.com>:
Sorry, I wasn't able to establish an SMTP connection. (#4.4.1)
I'm not going to try again; this message has been in the queue too long.

--- Below this line is a copy of the message.

Return-Path: <champagne_dan@yahoo.ca>
Received: (qmail 95342 invoked by uid 60001); 18 Jun 2009 06:29:04 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s1024; t=1245306544; bh=JClW8JjhpBBHmeTI6HyL7/13BDaFq973XiMeRZ22yWY=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=LVrzY2b2XDChGryrK+fYc0CnBUHy7RkRWmoC6VwXgNHw+P1/zNTIqfnXsE4vBD7PA7sEnOrrQTrk9THVU5dHnCL8YAOiwaIZCtFh7y/L4Ngq5isydNcD7QJGWGrmNezgz8LFtgM+NTPTKE5ZrXs2/anVgPP0olH8SsRAVIBbHpI=
DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=yahoo.ca;
  h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type;
  b=ZbahBCPImZY9qrHrQjmxTy+mo9wF0DACTVJkmS89qs/hlcgqlH31RW585ZxA4IqkeLJQuU0U5DnIRMobq9R2bCyAXv9G29xWPT5YeTpY1NLjJG1DgFjUuikpGAJUJ+EWtv4XPM79rDXKVy8GPniavhsrBIy2L/WUlFY524S9scM=;
Message-ID: <472084.93203.qm@web53204.mail.re2.yahoo.com>
X-YMail-OSG: Y.UnhhAVM1l6R9B7HwBnH7tvNFUYwsD2wL9gMt3xm2f.hlvrnRscSZdjHVgKfcRZ4klQJWN1xaVIDqiVSn0RuQ23znDl04THT_TFZViCYpq7OlXF7kpyTZvyTMG5cwnyYkImnnGnMivcbzWCHYn2RP9wRx3cZI3zXSF5R0ui9xUYjwiN4vpil4YM_E0XarrSgKAhm8E3w2wQtAtZZgorM13ti7l7ePYthH.xUuAddljInpR6YjzLlT0n28aPiL9cimUk7GcUC3vixqdR6J3v78gatRkHDGvRawsYbQtSB2w4E_ZkDawhVLYPu_AHgxqmp1NKdyBXCKnn0Ed0y6M_7qJi
Received: from [216.8.133.121] by web53204.mail.re2.yahoo.com via HTTP; Wed, 17 Jun 2009 23:29:04 PDT
X-Mailer: YahooMailClassic/5.4.12 YahooMailWebService/0.7.289.15
Date: Wed, 17 Jun 2009 23:29:04 -0700 (PDT)
From: Dan Champagne <champagne_dan@yahoo.ca>
Subject: Re: Trying to mark as not spam
To: Lego@blurr-ink.com
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii


TESTING!!!

--- On Sat, 6/13/09, Lego@blurr-ink.com <Lego@blurr-ink.com> wrote:

> From: Lego@blurr-ink.com <Lego@blurr-ink.com>
> Subject: Trying to mark as not spam
> To: champagne_dan@yahoo.ca
> Received: Saturday, June 13, 2009, 1:25 PM
> Trying to mark as not spam
>
```


----------



## Lego (Jun 19, 2009)

hotmail:

```
Delivery Status Notification (Delay)â€
From:  postmaster@mail.hotmail.com  
Sent: June 18, 2009 11:33:25 AM 
To:  champagne_dan@hotmail.com 
  2 attachments   
 details00...txt (0.2 KB), RE TESTIN...mht (1.5 KB)  
 

This is an automatically generated Delivery Status Notification. THIS IS A WARNING MESSAGE ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. Delivery to the following recipients has been delayed. lego@blurr-ink.com   


--Forwarded Message Attachment--
From: champagne_dan@hotmail.com
To: lego@blurr-ink.com
Subject: RE: TESTING
Date: Wed, 17 Jun 2009 23:29:38 -0700








TESTING!!!
 
> From: Lego@blurr-ink.com
> Subject: TESTING
> To: champagne_dan@hotmail.com
> CC: 
> Date: Sat, 13 Jun 2009 13:59:09 -0400
> 
> TESTING....
```

Do I possibly need Domain Routing, Domain Mapping, or Domain Masquerading setup? Im just looking at things in the sendmail server section of webmin..

I also just sent a message to root@blurr-ink.com to see if that makes a difference but I haven't recieved it yet either...


----------



## DutchDaemon (Jun 19, 2009)

Your smtp port is closed. What is the output of [cmd=]sockstat -l4 -p 25[/cmd] and [cmd=]netstat -an | grep \\.25[/cmd]? If port 25 shows up in both (and on all IP addresses ("*")), your ISP may be filtering port 25. It's not uncommon on dynamic IP ranges. Some ISPs require you to put their smtp server as a backup MX, which will in turn send the email on to you.


----------



## Lego (Jun 20, 2009)

Hmm, well my provider assures me none of my ports are blocked on there end.  I made sure I asked multiple people before registering for service; So I hope thats not the issue.

Here's the outputs:

```
$ sockstat -l4 -p 25
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     sendmail   19346 4  tcp4   127.0.0.1:25          *:*
$ netstat -an | grep \\.25
tcp4       0      0 127.0.0.1.25           *.*                    LISTEN
$
```

If that looks correct how would I put there mx server as one of my backups? That would be the in.mnsi.net??

I Also just checked to make sure port 25 was forwarded to my server and it is.


----------



## Lego (Jun 20, 2009)

I was reading: http://www.linode.com/irc/logs/linode.log-2006-11-13. Its an IRC thread, and in there it says if I configure postfix to use ssl on port 465 that would solve the problem, obviously Im using sendmail so I would configure sendmail to use ssl on port 465 but will that actually solve the problem?? I know I have certificates I made for like webmin, and what not, all signed by blurr-ink.com can I use those?


----------



## DutchDaemon (Jun 20, 2009)

Your sendmail is only running on localhost, not on your public IP address, so the outside world can't get to it (with or without port-forwarding). 

You'll have to put this in /etc/rc.conf

```
sendmail_enable="YES"
```
and restart sendmail. Then it will start the sendmail daemon on all interfaces, making it possible to receive email on your Internet IP address.

The entire Postfix/SSL reference is beyond me. It has nothing to do with solving the problem with receiving email on port 25. Try not to use too many hammers on one nail. You'll lose track.


----------



## Lego (Jun 20, 2009)

lol, good idea. geez, I forgot I removed that when I was getting the error with bind.ok, done.


```
blurr-ink# sockstat -l4 -p 25
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     sendmail   33931 4  tcp4   *:25                  *:*
blurr-ink# netstat -an | grep \\.25
tcp4       0     54 192.168.1.101.25       65.55.90.24.45396      FIN_WAIT_1
tcp4       0      0 *.25                   *.*                    LISTEN
blurr-ink#
```

does that look better now?


----------



## Lego (Jun 20, 2009)

Absolutely amazing!!!! It worked, well sort of.  Im now able to email root@blurr-ink.com, but yahoo gives this error when sending to Lego:

```
Hi. This is the qmail-send program at yahoo.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<Lego@blurr-ink.com>:
216.8.133.114 does not like recipient.
Remote host said: 550 5.1.1 <Lego@blurr-ink.com>... User unknown
Giving up on 216.8.133.114.

--- Below this line is a copy of the message.

Return-Path: <champagne_dan@yahoo.ca>
Received: (qmail 4381 invoked by uid 60001); 20 Jun 2009 13:48:59 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s1024; t=1245505739; bh=QGggaisavExibAXze589IzmrcmcEViOvh6JewskKpIk=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=e5AtKKOyFiCfqfNPZMiqFktKvHW0K0dTT00G5JP7BaiuDvqkFn3rv7Ntj/4qeZPAn4d7xyFnYcfZ5xS/Nggk+NBXAGOTcRvgUiW2I4iwYQ8VEgCGfD3/tybLXWulSf+YA+Er5dmZInjucrbtODhCVRPBnYC+WSy+5abxxng/ywY=
DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=yahoo.ca;
  h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type;
  b=ytwGRUUoqNvyICxsU0+VeXkUzAqLaEVh8pV3ZXaN++6CYwSg1inYVh5OF1AwiIJlTCzGXsxhxi1bb3gZ4968OlFI5G5ErUHbySAK8lqS+HpAkFgPbfOXpUK27tT1nDrM+HivYmr6aFaYPB0BL6asumeqkYM+8NQb8G8+IRJD/Ys=;
Message-ID: <465593.2262.qm@web53202.mail.re2.yahoo.com>
X-YMail-OSG: bQHhrd8VM1lUrn0aVlfnFHxK6ygE2UcJk1iZjo0pjxKoqZo0J2JDzesAKiQss_nS0Nh5_0G2ibs1M2HsPnIB9c1EaWhhpEFbjA.EvGkfIk0XSa9KwrIxvfQpKFSTdgasOCxPuayvvsZzVZZA2xnH.GwQsCO1if7HpXcM0BQdrEAWmr507d.P84mGxGaCLeTlpiywZN8cufw7..tmmcRZLzW2BvoyUzYK4q2LQozMyJNxrxqwBvPRNixF17z4moMyJ7vWbUNfPalOgjuRRz774Z1Tio3G6VmymCANwr.UOLsNFbs.nvvKxOuWzjLKrFthFn1r4hsEm1cH3XZa52vfFPRzJYieRv3.t0yQxov6c8BWc46UR1vXizk-
Received: from [216.8.133.114] by web53202.mail.re2.yahoo.com via HTTP; Sat, 20 Jun 2009 06:48:59 PDT
X-Mailer: YahooMailClassic/5.4.17 YahooMailWebService/0.7.289.15
Date: Sat, 20 Jun 2009 06:48:59 -0700 (PDT)
From: Dan Champagne <champagne_dan@yahoo.ca>
Subject: TESTING1.2.3
To: Lego@blurr-ink.com
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii


1.2.3.
```

Unknown user? its a local user do I have to create a special alias for Lego?


----------



## DutchDaemon (Jun 20, 2009)

If you have [email='Lego@blurr-ink.com]'Lego@blurr-ink.com[/email]' (or a catch-all [email='@blurr-ink.com]'@blurr-ink.com[/email]') in /etc/mail/virtusertable (with a valid mailbox as the second field -- mailbox names are case-sensitive!) and 'blurr-ink.com' in /etc/mail/local-host-names, it should work.


----------



## DutchDaemon (Jun 20, 2009)

By the way, you can test the validity of your email address on the server. As root, type [cmd=]sendmail -bv email@address.domain[/cmd] and see how it's being handled, if at all.


----------



## Lego (Jun 22, 2009)

ok, um. Well my system user is "Lego"; under read user mail the mailbox is called "Lego" (looking at it from webmin); So I assumed it would just be Lego@blurr-ink.com.  Um I do have the 'catch all' situation in the virtusertable "@blurr-ink.com" (how it looks in post #27, this thread). And, I do also have blurr-ink.com in the local-host-names (the same way as in post #27, this thread).


----------



## Lego (Jun 22, 2009)

this is the output for the sendmail syntax you gave:

```
blurr-ink# sendmail -bv Lego@blurr-ink.com
me@my.domain... deliverable: mailer esmtp, host my.domain, user me@my.domain
blurr-ink# sendmail -bv root@blurr-ink.com
root@blurr-ink.com... deliverable: mailer local, user root
blurr-ink#
```


----------



## Lego (Jun 22, 2009)

Ok I just send a mail from yahoo and hotmail both were to root@blurr-ink.com, and CC to Lego@blurr-ink.com BCC lego@blurr-ink.com and in my root mailbox I receive the message for root but Also receive this:

```
The original message was received at Sun, 21 Jun 2009 19:51:30 -0400 (EDT)
from localhost

   ----- The following addresses had permanent fatal errors -----
<champagne_dan@hotmail.com>
    (reason: 550 DY-001 Mail rejected by Windows Live Hotmail for policy reasons.
We generally do not accept emai...l/network admins, please visit http://postmaster.live.com
for email delivery information and support)

   ----- Transcript of session follows -----
... while talking to mx3.hotmail.com.:
>>> MAIL From:<> SIZE=2802
<<< 550 DY-001 Mail rejected by Windows Live Hotmail for policy reasons. We generally
do not accept email from dynamic IP's as they are not typically used to deliver unauthenticated
SMTP e-mail to an Internet mail server. http://www.spamhaus.org maintains lists of
dynamic and residential IP addresses. If you are not an email/network admin please
contact your E-mail/Internet Service Provider for help. Email/network admins, please
visit http://postmaster.live.com for email delivery information and support
554 5.0.0 Service unavailable
```

That doesn't make much sense to me.. how does hotmail/yahoo send the email to root@blurr-ink.com fine. but then gives me this error in my root@blurr-ink mailbox that it can't send it to Lego!?!?!?! I receive a similar message from yahoo with the same results. root receives but Lego doesn't;  Um whats weirder is neither hotmail or yahoo give me the postmaster error in my hotmail/yahoo mailbox.. it shows up in my root@blurr-ink.com mailbox! this so confusing...

I hope this all makes sense, like I'm explaining it right..


----------



## DutchDaemon (Jun 22, 2009)

Lego said:
			
		

> this is the output for the sendmail syntax you gave:
> 
> ```
> blurr-ink# sendmail -bv Lego@blurr-ink.com
> ...



You'll have to figure out where that comes from (hosts, aliases?), because it is obviously incorrect, and that's why email to that address bounces. When set up correctly, it will look just like the root@ line, only with Lego@ in its place.


----------



## DutchDaemon (Jun 22, 2009)

Lego said:
			
		

> Ok I just send a mail from yahoo and hotmail both were to root@blurr-ink.com, and CC to Lego@blurr-ink.com BCC lego@blurr-ink.com and in my root mailbox I receive the message for root but Also receive this:


[snip]

The email to the Lego@ address bounces back, and since it bounces back directly from a dynamic IP address, it gets refused for policy reasons. Solve the Lego@ bounces (the way the address is handled on your server is not correct) and this problem will go away.


----------



## DutchDaemon (Jun 22, 2009)

By the way, this thread is now close to 50 posts long, and you'll really have to get your configuration in order soon. I can't keep troubleshooting your setup indefinitely. There's an entire forum to keep an eye on...


----------



## Lego (Jun 22, 2009)

Well, I didn't figured out whats wrong, but did get something.  Its not recongizing my system user. Because, I added to the virtusertable:

```
lego@blurr-ink.com  root
```

Then I was able to receive the mail, it went to the root box instead of Lego, So why won't it send to Lego?  the username is "Lego" like when I boot the machine and login, and even under the users screen and mailboxes its Lego but nothing seems to send to that Box, I have added Lego to the trusted users list aswell.


----------



## Lego (Jun 22, 2009)

Also, I do appreciate the help, I've said this many times already.  nobody said you needed to answer my post every single time, I mean don't get me wrong I really appreciate it and you've been right on with everything, But in all honesty, did it really need to be said that this is a long thread,  I'm still fairly new to bsd, and setting up servers, and from what I understand mail is the hardest to get working, so I would expect a long thread, and who's to say that someone isn't reading this thread and taking from it, to help themselfs get it working? this thread covers more details then most of the articles I've read, and isn't the forum for everyone to talk and work together? Im sorry If you take offense to this post, but Im just trying to learn like the rest.  Again, I do thank you for all the help and hope you will continue to help me but I felt this needed to be said as a person new to the OS and trying to get into the community and learn whatever I can about the systems. Some installation and configuration articles are so vague, the forum is the best place to learn.


----------



## DutchDaemon (Jun 22, 2009)

[cmd=]sendmail -bv Lego[/cmd]

Make sure Lego is not aliased somewhere else (like Lego -> root -> me@my.domain in /etc/mail/aliases).


----------



## DutchDaemon (Jun 22, 2009)

All I'm saying is that the type of actions you perform (i.e. the errors you still make) and the kind of questions you ask are covered in the documentation I pointed you to. I still think you're trying too many things at once and losing track of what causes the next error. Small steps, and read; e.g.: test mail locally before you start mailing yourself from other places, trying to interpret customised error messages from Yahoo/Hotmail, etc.


----------



## Lego (Jun 22, 2009)

yea, I see your point. I haven't been able to send mail from root user to Lego locally. But again can send to root from Lego (locally).  I have tried that. It's almost like Lego is a system user, but sendmail doesn't want to recongize the user.

```
blurr-ink# sendmail -bv Lego
Lego... User unknown
blurr-ink# sendmail -bv lego
lego... User unknown
```


----------



## DutchDaemon (Jun 22, 2009)

Check /etc/mail/aliases.


----------



## Lego (Jun 22, 2009)

yes, I have, I've tried a multitude of arrangements for Lego in the aliases file.

http://www.freebsd.org/doc/en/books/handbook/sendmail.html

In the alias section it shows:

```
root: localuser
ftp-bugs: joe,eric,paul
bit.bucket:  /dev/null
procmail: "|/usr/local/bin/procmail"
```

I've tried Lego: localuser, Lego: Lego, lego: Lego. None of which worked. I've also tried to create an alias for Lego with webmin.  Oh, and It keeps removing Lego from my list of trusted Users(the webmin page 'local users trusted by sendmail' - root,daemon,uucp are the others listed), Every time I added Lego and hit save it just refreshs the page and its gone.


----------



## DutchDaemon (Jun 22, 2009)

But why would you want 'Lego' in your aliases _at all_ when it is already a valid local user with a local mailbox? 

Aliases is used to map non-existing local users (like 'daemon' or 'operator') to an existing local user (like 'root'). Look in /usr/src/etc/mail/aliases. Thta's what an aliases file should look like: every system account pointing to 'root', nothing else. You're already routing your email using virtusertable -- don't let aliases interfere.

The second field in the virtusertable is first checked against the aliases file, and if that field is not in there, it gets looked up in the password file (the list of local users). That should work in your case, because you have a local account Lego (and probably a mailbox in /var/mail/Lego).


----------



## Lego (Jun 22, 2009)

I see what you mean, but I've tried it without Lego listed in the alias file. Right now All files look like this.
access only 127.0.0.1 listed as ok
aliases restored completely to original
local-hostnames:

```
blurr-ink.com
mx.blurr-ink.com
```
mailer.conf unmodified
mailertable empty
virtusertable:

```
root@blurr-ink.com      root
postmaster@mx.blurr-ink.com      root
lego@blurr-ink.com      Lego
```

Now that means that the only entry referring to Lego, is in virtusertable, So I just retarted the server and used the sendmail syntax you gave me and it says

```
blurr-ink# sendmail -bv Lego
Lego... User unknown
blurr-ink# sendmail -bv lego
lego... User unknown
blurr-ink# sendmail -bv lego@blurr-ink.com
lego@blurr-ink.com... User unknown
```

But if i change (virtusertable) lego@blurr-ink.com Lego to lego@blurr-ink.com root it delivers fine to root box, thats why I'm so confused. Everything seems to be setup properly but sendmail doesn't recongize Lego in any way other then showing the /var/mail/Lego mailbox.


----------



## DutchDaemon (Jun 22, 2009)

Could you post the output of [cmd=]finger Lego[/cmd]?


----------



## Lego (Jun 23, 2009)

sure can! lol, I must say I though you were playing with me when I first read the command.

```
$ su
Password:
blurr-ink# finger Lego
Login: Lego                             Name: Lego
Directory: /home/Lego                   Shell: /bin/sh
On since Mon Jun 22 19:12 (EDT) on ttyv0, idle 0:01 (messages off)
On since Mon Jun 22 19:12 (EDT) on :0 (messages off)
No Mail.
No Plan.
blurr-ink#
```

Does it matter that the login name and the real name are the same? or that shouldn't matter, I can change it to login Lego and real name Dan if that will help


----------



## DutchDaemon (Jun 23, 2009)

Your real name doesn't come into play anywhere. I don't understand why a valid account cannot serve as the right-hand side of your virtusertable. 

Could you try creating an entirely new account from scratch and setting that as the right-hand side of an email address in virtusertable? 

Something is obviously getting in the way between virtusertable and the mailbox, but I can't guess what that might be (well I can, but I don't assume you've installed procmail or anything like that out of the blue).


----------



## Lego (Jun 24, 2009)

I can, and will, but I have to wait until I get home, because I'll be out of the city for a few days.


----------



## Lego (Jul 14, 2009)

Ok, well I got back in the city then me and my fiance moved, lol. Either way, I just put the server back up yesterday, and waited for the dns to resolve, I made sure mail was sending to root again, which it is.  Then created a new user Dan and put it for the right side in the virtusertable for lego@blurr-ink.com. No luck


----------



## DutchDaemon (Jul 14, 2009)

And [cmd=]sendmail -bv Dan[/cmd] gives you a 'user unknown' again? What happens when you use


```
echo test | mail -s "Test" Dan
```

Try with all left- and right-hand side addresses in virtusertable.


----------



## Lego (Jul 14, 2009)

```
$ su
Password:
blurr-ink# echo test | mail -s "Test" Dan
blurr-ink# echo test | mail -s "Test" Lego
blurr-ink# echo test | mail -s "Test" root
blurr-ink# echo test | mail -s "Test" root@blurr-ink.com
blurr-ink# echo test | mail -s "Test" lego@blurr-ink.com
blurr-ink# echo test | mail -s "Test" postmaster@mx.blurr-ink.com
blurr-ink# echo test | mail -s "Test" champagne_dan@blurr-ink.com
```


```
The original message was received at Tue, 14 Jul 2009 14:34:39 -0400 (EDT)
from localhost

   ----- The following addresses had permanent fatal errors -----
Lego
    (reason: 550 5.1.1 <Lego@blurr-ink.com>... User unknown)
    (expanded from: Lego)

   ----- Transcript of session follows -----
... while talking to [127.0.0.1]:
>>> DATA
<<< 550 5.1.1 <Lego@blurr-ink.com>... User unknown
550 5.1.1 Lego... User unknown
<<< 503 5.0.0 Need RCPT (recipient)
```

3 failed, Dan, Lego, lego@blurr-ink.com which was to go to Dan.


----------



## DutchDaemon (Jul 14, 2009)

Well, this is quite a surprise to me (after 16 years of FreeBSD mail admin-ing ...), but it did seem the only plausible explanation that was left: drop the capitals from the usernames everywhere.

I tested with a local account 'Dan' and a local account 'dan'. This was the result for 'Dan':


```
Diagnostic-Code: SMTP; 550 5.1.1 <Dan@box.domain.local>... User unknown
```

The mail to 'dan' had no problems. Of course you can use any kind of capitalization in email addresses (so Lego@yourdomain is absolutely ok), but the local username (the right-hand side of virtusertable, e.g. Lego or Dan) *must* be all lowercase. 

In other words: accounts on your box must be all-lowercase.

Moreover: mail sent to a local user 'Dan' will end up in the mailbox of 'dan' (if user 'dan' exists), and mail to a local user 'Lego' will end up in the mailbox of 'lego' (if user 'lego' exists). They will *never* end up in the mailboxes of 'Dan' or 'Lego', even if these users exist.


----------



## Lego (Jul 14, 2009)

LOL, wow, yup that fixed it.  I deleted user Lego and Dan, created lego, and in virtusertable put

```
dan@blurr-ink.com      lego
```

worked perfectly.  Thanks!  I never would have thought that the localuser would have to be all lowercase.


----------



## DutchDaemon (Jul 14, 2009)

Well, it took me a while too  Glad it works.


----------

