# sending email



## fuhdan (Jul 14, 2010)

Hi all
I installed a mailserver on freebsd 8.0
Everthing works, exept the following:
I wrote a Script to send EMails:

```
#!/bin/sh
CONTACTEMAIL="$1"
MAILFILE="/tmp/mail.txt"
SENDEREMAIL="vorname.name@subdomain.domain.com"

/usr/bin/printf "subject:** Subject **\n" > $MAILFILE
/usr/bin/printf "First Line\n" >> $MAILFILE
/usr/bin/printf "Second Line\n" >> $MAILFILE

/usr/sbin/sendmail -f "$SENDEREMAIL" "$CONTACTEMAIL" < "$MAILFILE"
```

If I run that via cron, I get the following maillog entries:
Localhost:

```
Jul 14 14:24:04 host sendmail[26099]: o6ECO4Mf026099: Authentication-Warning: host.sub.domain.com: host set sender to 
[email]vorname.name@subdomain.domain.com[/email] using -f
Jul 14 14:24:04 host sendmail[26099]: o6ECO4Mf026099: from=vorname.name@subdomain.domain.com, size=257, class=0, nrcpts=1, 
msgid=<201007141224.o6ECO4Mf026099@host.sub.domain.com>, relay=host@localhost
Jul 14 14:24:04 host sm-mta[26100]: o6ECO4p5026100: from=<vorname.name@subdomain.domain.com>, size=742, class=0, nrcpts=1, 
msgid=<201007141224.o6ECO4Mf026099@host.sub.domain.com>, proto=ESMTP, daemon=Daemon0, relay=localhost [127.0.0.1]
Jul 14 14:24:04 host sendmail[26099]: o6ECO4Mf026099: to=recpt@subdomain.domain.com, ctladdr=vorname.name@subdomain.domain.com (181/181), 
delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30257, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o6ECO4p5026100 Message accepted 
for delivery)
Jul 14 14:24:04 host sm-mta[26102]: STARTTLS=client, relay=pop.subdomain.domain.com., version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-
SHA, bits=256/256
Jul 14 14:24:04 host sm-mta[26102]: o6ECO4p5026100: to=<recpt@subdomain.domain.com>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=30742, 
relay=pop.subdomain.domain.com. [192.168.1.52], dsn=5.1.1, stat=User unknown
Jul 14 14:24:04 host sm-mta[26102]: o6ECO4p5026100: o6ECO4p5026102: DSN: User unknown
Jul 14 14:24:04 host sm-mta[26102]: o6ECO4p5026102: to=<vorname.name@subdomain.domain.com>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, 
pri=31766, relay=pop.subdomain.domain.com. [192.168.1.52], dsn=2.0.0, stat=Sent (Ok: queued as 02D5533DDA)
```

On the pop.subdomain.domain.com I get:

```
Jul 14 14:24:07 pop postfix/smtpd[85483]: connect from senderhost.subdomain.domain.com.[192.168.1.51]
Jul 14 14:24:08 pop postfix/smtpd[85483]: NOQUEUE: reject: RCPT from senderhost.subdomain.domain.com[192.168.1.51]: 550 5.1.1 
<recpt@subdomain.domain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<vorname.name@subdomain.domain.com> 
to=<recpt@subdomain.domain.com> proto=ESMTP helo=<senderhost.subdomain.domain.com>
Jul 14 14:24:08 pop postfix/smtpd[85483]: 02D5533DDA: client=senderhost.subdomain.domain.com[192.168.1.51]
Jul 14 14:24:08 pop postfix/cleanup[85486]: 02D5533DDA: message-id=<201007141224.o6ECO4p5026102@senderhost.subdomain.domain.com>
Jul 14 14:24:08 pop postfix/qmgr[81783]: 02D5533DDA: from=<>, size=3503, nrcpt=1 (queue active)
Jul 14 14:24:08 pop postfix/smtpd[85483]: disconnect from senderhost.subdomain.domain.com[192.168.1.51]
Jul 14 14:24:08 pop postfix/virtual[85487]: 02D5533DDA: to=<vorname.name@subdomain.domain.com>, relay=virtual, delay=0.13, delays=0.12/0/0/0, 
dsn=2.0.0, status=sent (delivered to maildir)
Jul 14 14:24:08 pop postfix/qmgr[81783]: 02D5533DDA: removed
Jul 14 14:27:36 pop postfix/anvil[85467]: statistics: max connection rate 2/60s for (smtp:192.168.1.51) at Jul 14 14:24:07
Jul 14 14:27:36 pop postfix/anvil[85467]: statistics: max connection count 1 for (smtp:192.168.1.51) at Jul 14 14:20:09
Jul 14 14:27:36 pop postfix/anvil[85467]: statistics: max cache size 1 at Jul 14 14:20:09
```

The Mail is not delovered. But if I run the Script as logged in user (root). The mail is delivered.

Both mailboxes (vorname.name@subdomain.domain.com, recpt@subdomain.domain.com) exists on the host pop.

I use postfix, dovecot, mysql, postfixadmin, php, apache22

Thanks for your help.

Cheers
Daniel


----------



## hydra (Jul 16, 2010)

Try to fix this:


```
Jul 14 14:24:08 pop postfix/smtpd[85483]: NOQUEUE: reject: RCPT from senderhost.subdomain.domain.com[192.168.1.51]: 550 
5.1.1 <recpt@subdomain.domain.com>: Recipient address rejected: User unknown in virtual mailbox table; 
from=<vorname.name@subdomain.domain.com> to=<recpt@subdomain.domain.com> proto=ESMTP helo=<senderhost.subdomain.domain.com>
```


----------



## fuhdan (Jul 17, 2010)

Thx
I recreated the Mailbox and IT worked. I don't Know why but IT Works now.

Cheers Daniel


----------

