I'm running mail server on Ubuntu 12.04 and box has Web Server + Mail Server (Postfix + Dovecot). This is Virtual Machine setup on Windows Azure cloud.

Problem: I'm unable to send emails outside network. Following are the configuration and logs.


alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
dovecot_destination_recipient_limit = 1
inet_interfaces = all
mailbox_size_limit = 0
mydestination = abc.cloudapp.net, localhost.abc.cloudapp.net, localhost
myhostname = abc.cloudapp.net
mynetworks = [::ffff:]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = dovecot


# 2.0.19: /etc/dovecot/dovecot.conf
# OS: Linux 3.2.0-65-virtual x86_64 Ubuntu 12.04.4 LTS ext4
auth_mechanisms = plain login
mail_location = maildir:/var/vmail/%d/%n/Maildir
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
plugin {
  sieve = ~/.dovecot.sieve
  sieve_dir = ~/sieve
protocols = " imap sieve pop3"
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  unix_listener auth-userdb {
    group = vmail
    user = vmail
ssl_cert = </etc/ssl/certs/mailserver.pem
ssl_key = </etc/ssl/private/mailserver.pem
userdb {
  args = uid=vmail gid=vmail home=/var/vmail/%d/%n
  driver = static
protocol lda {
  mail_plugins = " sieve"


Jul  9 08:40:11 layfootak postfix/smtpd[44127]: connect from unknown[]
Jul  9 08:40:12 layfootak postfix/smtpd[44127]: NOQUEUE: reject: RCPT from unknown[]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<[]>

I'm able to configure and get emails properly with Mozilla Thunderbird email client. It shows my inbox properly but when I'm sending an email to other email address like outside network then it gives Relay access denied; from= to= proto=ESMTP helo=<[]>

Please advise me.

I've fixed the Problem after setting up following postfix configuration for SMTP Relaying configuration:

sudo postconf -e smtpd_sasl_type=dovecot
sudo postconf -e smtpd_sasl_path=private/auth
sudo postconf -e smtpd_sasl_auth_enable=yes
sudo postconf -e smtpd_tls_security_level=may
sudo postconf -e smtpd_tls_auth_only=yes
sudo postconf -e smtpd_tls_cert_file=/etc/ssl/certs/mailserver.pem
sudo postconf -e smtpd_tls_key_file=/etc/ssl/private/mailserver.pem
sudo postconf -e smtpd_recipient_restrictions=" \
  permit_mynetworks \
  permit_sasl_authenticated \
  • 1
    For you test, do you have Thunderbird on the same machine as Postfix ? In final, do you want to use only Thunderbird to send mail or do you plan to install a web mail solution to do this ?
    – Justin
    Commented Jul 9, 2014 at 9:03

1 Answer 1


Sending mail to domains not hosted on your Postfix (external mails thus) is only possible for IP and networks allowed to do relaying by the configuration of Postfix.

In Postfix, this is achieved by giving these allowed IP's and networks to the mynetworks configuration directive in main.cf.

In your case, it shows that only localhost is allowed to relay mail outside your Postfix installation.

To allow you to send mail outside without making your server an open relay you should at least add the IP of the clients that need to send external mails.

mynetworks = [::ffff:]/104 [::1]/128 A.B.C.D/32

Note the /32 after the IP address, this is to be sure that Postfix will not allow the whole subnet but just that particular address.

If all the clients are on the same subnet, you can configure (example: all your clients are connected to a network with as mask) :

mynetworks = [::ffff:]/104 [::1]/128

Of course, if you plan to install a webmail based software for your users, the only allowed host to send & relay mail would be the web server itself. In this case, you don't have to modify the configuration of Postfix but be sure that your web mail solution use as SMTP server.

  • Problem was not related with mynetworks configuration. I made some configuration for Relaying SMTP and Authentication for Postfix.
    – user379367
    Commented Jul 9, 2014 at 10:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .