cannot send mail with postfix and dovecot

Another question about mail server.
I follow many tutorial and their instructions to set up a mail server on my Freebsd11 machine.
when I run the swaks --from --to --server <ip>:25, the output of /var/log/dovecot-error is:
 deliver( Fatal: setuid(5002) failed with euid=5001(vmail): Operation not permitted (This binary should probably be called with process user set to 5002 instead of 5001(vmail))
I define user vamil with uid:5000 and group vmail with gid 5000 in my system.

These are the steps:
1. install openldap
2. install postfix
3. install dovecot
The configs are:
base_dir = /var/run/dovecot/
protocols = imap pop3
protocol imap {
        listen = *:143
protocol pop3  {
    listen= *:110
disable_plaintext_auth = no
log_path = /var/log/dovecot-error
info_log_path = /var/log/dovecot-info
ssl = no
login_dir = /var/run/dovecot/login
login_chroot = yes
login_user = dovecot
login_greeting = Dovecot ready.
mail_location = maildir:~/Maildir/%u
mail_privileged_group = mail
dotlock_use_excl = yes
verbose_proctitle = yes

first_valid_uid = 1000
first_valid_gid = 1000

protocol imap {
  login_executable = /usr/local/libexec/dovecot/imap-login
  mail_executable = /usr/local/libexec/dovecot/imap
  imap_client_workarounds = delay-newmail netscape-eoh tb-extra-mailbox-sep
protocol pop3 {
  login_executable = /usr/local/libexec/dovecot/pop3-login
  mail_executable = /usr/local/libexec/dovecot/pop3
  pop3_uidl_format = %08Xu%08Xv
  mail_max_userip_connections = 3
  mail_plugin_dir = /usr/local/lib/dovecot/pop3
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
protocol managesieve {
  login_executable = /usr/local/libexec/dovecot/managesieve-login
  mail_executable = /usr/local/libexec/dovecot/managesieve

protocol lda {
  postmaster_address =
  mail_plugin_dir = /usr/local/lib/dovecot/lda
  sendmail_path = /usr/sbin/sendmail
  auth_socket_path = /var/run/dovecot/auth-master

auth_executable = /usr/local/libexec/dovecot/dovecot-auth
auth_process_size = 256
auth_username_format = %Lu

auth default {
  mechanisms = plain login
  passdb ldap {
    args = /usr/local/etc/dovecot-ldap.conf
  userdb passwd {
    args = blocking=yes
  userdb ldap {
    args = /usr/local/etc/dovecot-ldap.conf
  user = root
  socket listen {
    master {
      path = /var/run/dovecot/auth-master
    client {
      path = /var/run/dovecot/auth-client
      mode = 0660
      user = postfix
      group = postfix
dict_db_config = /usr/local/etc/dovecot-db.conf

hosts = localhost
debug_level = -1
auth_bind = no
ldap_version = 3
base =ou=people,dc=example,dc=com
deref = never
scope = subtree
user_attrs = mailHomeDirectory=home,mailUidNumber=uid,mailGidNumber=gid,mailStorageDirectory=mail
user_filter = (&(objectClass=postfixUser)(uid=%n))
pass_attrs = uid=user,userPassword=password
pass_filter = (&(objectClass=postfixUser)(uid=%n))
default_pass_scheme = LDAP-MD5

# postfix/
inet_interfaces = all
inet_protocols = ipv4
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
myhostname =
append_dot_mydomain = no
mynetworks =
   # Local
    # External
local_transport = error:Local Transport Disabled
alias_maps = hash:/etc/aliases
mydomain =
mydestination =
virtual_transport = dovecot
smtpd_sasl_auth_enable = yes
dovecot   unix  -       n       n       -       -       pipe
        flags=ODRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/deliver -e -f ${sender} -d ${recipient}

# example.ldif is:
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: example
dc: example

dn: ou=people,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: people

dn: ou=services,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: services

dn: uid=postfix,ou=services,dc=example,dc=com
objectClass: account
objectClass: top
uid: postfix

dn: uid=dovecot,ou=services,dc=example,dc=com
objectClass: account
objectClass: top
uid: dovecot

dn: uid=user1,ou=people,dc=example,dc=com
objectClass: organizationalPerson
objectClass: person
objectClass: top
objectClass: postfixUser
objectClass: extensibleObject
cn: user1
givenName: user1
mailEnabled: TRUE
mailGidNumber: 5000
mailHomeDirectory: /var/vmail/
mailQuota: 10240
mailStorageDirectory: maildir:/vmail/
mailUidNumber: 5002
sn: Some2
uid: user1
userPassword: ******

dn: uid=user2,ou=people,dc=example,dc=com
objectClass: organizationalPerson
objectClass: person
objectClass: top
objectClass: postfixUser
objectClass: extensibleObject
cn: user2
givenName: user2
mailEnabled: TRUE
mailGidNumber: 5000
mailHomeDirectory: /var/vmail/
mailQuota: 10240
mailStorageDirectory: maildir:/vmail/
mailUidNumber: 5003
sn: Some3
uid: user2
userPassword: ******
Sorry, my post is too long.

Dovecot is only used to read mail through IMAP or POP3. Sending (and receiving) email is always done through SMTP and in your case it's Postfix that handles that.
Thank you for your response.

Would you please help me and say which part of config should change and another question is where is the emails location?
I'm not too familiar with Postfix, I can fix some basic issues but that's about it. My own mail server uses Exim. But focus on Postfix first. Turn off Dovecot. Make sure Postfix correctly accepts submissions and external SMTP connections to deliver mail. Double check and adjust where local mail gets stored on the system (this will be important for Dovecot later on).
Do you see anything specific in /var/log/maillog?

Also, what's swaks? I run Postfix + Dovecot myself but never heard of that one before. I assume it's a sendmail kind of thingie, but if you're troubleshooting it might be more productive to use telnet instead so that you get to see the (error) messages which you get during the session.
Do you see anything specific in /var/log/maillog
Sep 14 14:24:30 mail postfix/smtpd[908]: connect from[<ip>]
Sep 14 14:24:30 mail postfix/smtpd[908]: A2A80115F5E:[<ip>]
Sep 14 14:24:30 mail postfix/cleanup[911]: A2A80115F5E: message-id=<>
Sep 14 14:24:30 mail postfix/smtpd[908]: disconnect from[<ip>] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Sep 14 14:24:30 mail postfix/qmgr[778]: A2A80115F5E: from=<>, size=468, nrcpt=1 (queue active)
Sep 14 14:24:30 mail postfix/pipe[912]: A2A80115F5E: to=<>, relay=dovecot, delay=0.16, delays=0.11/0.01/0/0.04, dsn=4.3.0, status=deferred (temporary failure)
what's swaks
swaks is a SMTP test tool. this is the output of swaks:

root@mail:~ # swaks --from --to --server <ip>:25
=== Trying <ip>:25...
=== Connected to <ip>.
<-  220 ESMTP Postfix
 -> EHLO
<-  250-SIZE 10240000
<-  250-ETRN
<-  250-8BITMIME
<-  250 DSN
 -> MAIL FROM:<>
<-  250 2.1.0 Ok
 -> RCPT TO:<>
<-  250 2.1.5 Ok
 -> DATA
<-  354 End data with <CR><LF>.<CR><LF>
 -> Date: Thu, 14 Sep 2017 14:24:30 +0430
 -> To:
 -> From:
 -> Subject: test Thu, 14 Sep 2017 14:24:30 +0430
 -> X-Mailer: swaks v20130209.0
 -> This is a test mailing
 -> .
<-  250 2.0.0 Ok: queued as A2A80115F5E
 -> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.
root@mail:~ #
Well, when basing myself on that last post it appears to work normally. Seems the first error wasn't so much caused by sending the e-mail but more so by Dovecot. It's a nice program (Dovecot) but I can't help think that they're also overcomplicating things quite a bit (I'm specifically not a big fan of the "let's split the configuration into 100 different files" approach).

Anyway.. I think you're looking for first_valid_uid and last_valid_uid, which can be found in conf.d/10-mail.conf. Other than that I can't really comment because I only use Dovecot for retrieval, not delivery. For local delivery I usually rely on Procmail which I use through the mailbox_command setting in (Postfix).
first_valid_uid and last_valid_uid
I set first_valid_uid and last_valid_uid to 5000. In my system I have user vmail with uid 5000 and gid 5000, but it doesn't work.

Now I set the mailUidNumber: 5000 in my ldif file. The error disapear and another error apear:D.
deliver( Error: mkdir(/vmail/ failed: Permission denied (euid=5000(vmail) egid=5000(vmail))

I changed mailHomeDirectory: /var/vmail and mailStorageDirectory: /var/vmail, so the email delivered.

My question is: Are these new configs right? And how can I have the personal mail directory
for each user?

I spent a lot of time on my mailserver and i'm so confused.

Thank you for wasting your time to solve my problem.