3

Mail server works fine when send mail from server, but when I use some mail client it not work.

I found this in logs:

Jul 12 19:45:04 tvsite postfix/smtpd[3356]: warning: hostname adsl-bb29-l44 does not resolve to address xxx.xxx.xxx.xxx: Name or service not known
Jul 12 19:45:04 tvsite postfix/smtpd[3356]: connect from unknown[xxx.xxx.xxx.xxx]
Jul 12 19:45:04 tvsite postfix/smtpd[3356]: NOQUEUE: reject: RCPT from unknown[xxx.xxx.xxx.xxx4]: 454 4.7.1 <dabeticmisko4@gmail.com>: Relay access denied; from=<sha1@tvsite.tvsite.uni.me> to=<dabeticmisko4@gmail.com> proto=ESMTP helo=<S>
Jul 12 19:45:04 tvsite postfix/smtpd[3356]: lost connection after RCPT from unknown[xxx.xxx.xxx.xxx]
Jul 12 19:45:04 tvsite postfix/smtpd[3356]: disconnect from unknown[xxx.xxx.xxx.xxx]

Also my mail client back this message:

Client does not have permission to submit mail to this server. The server response was: 4.7.1 <dabeticmisko4@gmail.com>: Relay access denied

This is my main.cf for postfix:

# INTERNET HOST AND DOMAIN NAMES
# 
# The myhostname parameter specifies the internet hostname of this
# mail system. The default is to use the fully-qualified domain name
# from gethostname(). $myhostname is used as a default value for many
# other configuration parameters.
#
myhostname = tvsite.tvsite.uni.me

# The mydomain parameter specifies the local internet domain name.
# The default is to use $myhostname minus the first component.
# $mydomain is used as a default value for many other configuration
# parameters.
#
mydomain = tvsite.uni.me

# SENDING MAIL
# 
# The myorigin parameter specifies the domain that locally-posted
# mail appears to come from. The default is to append $myhostname,
# which is fine for small sites.  If you run a domain with multiple
# machines, you should (1) change this to $mydomain and (2) set up
# a domain-wide alias database that aliases each user to
# user@that.users.mailhost.
#
# For the sake of consistency between sender and recipient addresses,
# myorigin also specifies the default domain name that is appended
# to recipient addresses that have no @domain part.
#
myorigin = $myhostname

# RECEIVING MAIL

# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on.  By default,
# the software claims all active interfaces on the machine. The
# parameter also controls delivery of mail to user@[ip.address].
#
# See also the proxy_interfaces parameter, for network addresses that
# are forwarded to us via a proxy or network address translator.
#
# Note: you need to stop/start Postfix when this parameter changes.
#
inet_interfaces = all

# The mydestination parameter specifies the list of domains that this
# machine considers itself the final destination for.
#
# These domains are routed to the delivery agent specified with the
# local_transport parameter setting. By default, that is the UNIX
# compatible delivery agent that lookups all recipients in /etc/passwd
# and /etc/aliases or their equivalent.
#
# The default is $myhostname + localhost.$mydomain.  On a mail domain
# gateway, you should also include $mydomain.
#
# Do not specify the names of virtual domains - those domains are
# specified elsewhere (see VIRTUAL_README).
#
# Do not specify the names of domains that this machine is backup MX
# host for. Specify those names via the relay_domains settings for
# the SMTP server, or use permit_mx_backup if you are lazy (see
# STANDARD_CONFIGURATION_README).
#
# The local machine is always the final destination for mail addressed
# to user@[the.net.work.address] of an interface that the mail system
# receives mail on (see the inet_interfaces parameter).
#
# Specify a list of host or domain names, /file/name or type:table
# patterns, separated by commas and/or whitespace. A /file/name
# pattern is replaced by its contents; a type:table is matched when
# a name matches a lookup key (the right-hand side is ignored).
# Continue long lines by starting the next line with whitespace.
#
# See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
#
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# The unknown_local_recipient_reject_code specifies the SMTP server
# response code when a recipient domain matches $mydestination or
# ${proxy,inet}_interfaces, while $local_recipient_maps is non-empty
# and the recipient address or address local-part is not found.
#
# The default setting is 550 (reject mail) but it is safer to start
# with 450 (try again later) until you are certain that your
# local_recipient_maps settings are OK.
#
unknown_local_recipient_reject_code = 550

# TRUST AND RELAY CONTROL

# The mynetworks parameter specifies the list of "trusted" SMTP
# clients that have more privileges than "strangers".
#
# In particular, "trusted" SMTP clients are allowed to relay mail
# through Postfix.  See the smtpd_recipient_restrictions parameter
# in postconf(5).
#
# You can specify the list of "trusted" network addresses by hand
# or you can let Postfix do it for you (which is the default).
#
# By default (mynetworks_style = subnet), Postfix "trusts" SMTP
# clients in the same IP subnetworks as the local machine.
# On Linux, this does works correctly only with interfaces specified
# with the "ifconfig" command.
# 
# Specify "mynetworks_style = class" when Postfix should "trust" SMTP
# clients in the same IP class A/B/C networks as the local machine.
# Don't do this with a dialup site - it would cause Postfix to "trust"
# your entire provider's network.  Instead, specify an explicit
# mynetworks list by hand, as described below.
#  
# Specify "mynetworks_style = host" when Postfix should "trust"
# only the local machine.
# 
#mynetworks_style = class
#mynetworks_style = subnet
#mynetworks_style = host
mynetworks =  178.32.152.29 127.0.0.0/8

# ALIAS DATABASE
#
# The alias_maps parameter specifies the list of alias databases used
# by the local delivery agent. The default list is system dependent.
#
# On systems with NIS, the default is to search the local alias
# database, then the NIS alias database. See aliases(5) for syntax
# details.
# 
# If you change the alias database, run "postalias /etc/aliases" (or
# wherever your system stores the mail alias file), or simply run
# "newaliases" to build the necessary DBM or DB file.
#
# It will take a minute or so before changes become visible.  Use
# "postfix reload" to eliminate the delay.
#
alias_maps = hash:/etc/postfix/aliases

# The alias_database parameter specifies the alias database(s) that
# are built with "newaliases" or "sendmail -bi".  This is a separate
# configuration parameter, because alias_maps (see above) may specify
# tables that are not necessarily all under control by Postfix.
#
alias_database = hash:/etc/postfix/aliases

# DELIVERY TO MAILBOX
#
# The home_mailbox parameter specifies the optional pathname of a
# mailbox file relative to a user's home directory. The default
# mailbox file is /var/spool/mail/user or /var/mail/user.  Specify
# "Maildir/" for qmail-style delivery (the / is required).
#
home_mailbox = Maildir/

# The mail_spool_directory parameter specifies the directory where
# UNIX-style mailboxes are kept. The default setting depends on the
# system type.
#
mail_spool_directory = /var/mail

# DEBUGGING CONTROL
#
# The debug_peer_level parameter specifies the increment in verbose
# logging level when an SMTP client or server host name or address
# matches a pattern in the debug_peer_list parameter.
#
debug_peer_level = 2

# The debugger_command specifies the external command that is executed
# when a Postfix daemon program is run with the -D option.
#
# Use "command .. & sleep 5" so that the debugger can attach before
# the process marches on. If you use an X-based debugger, be sure to
# set up your XAUTHORITY environment variable before starting Postfix.
#
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     ddd $daemon_directory/$process_name $process_id & sleep 5

# If you can't use X, use this to capture the call stack when a
# daemon crashes. The result is in a file in the configuration
# directory, and is named after the process name and the process ID.
#
# debugger_command =
#   PATH=/bin:/usr/bin:/usr/local/bin; export PATH; (echo cont;
#   echo where) | gdb $daemon_directory/$process_name $process_id 2>&1
#   >$config_directory/$process_name.$process_id.log & sleep 5
#
# Another possibility is to run gdb under a detached screen session.
# To attach to the screen sesssion, su root and run "screen -r
# <id_string>" where <id_string> uniquely matches one of the detached
# sessions (from "screen -list").
#
# debugger_command =
#   PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH; screen
#   -dmS $process_name gdb $daemon_directory/$process_name
#   $process_id & sleep 1

# INSTALL-TIME CONFIGURATION INFORMATION
#
# The following parameters are used when installing a new Postfix version.
# 
# sendmail_path: The full pathname of the Postfix sendmail command.
# This is the Sendmail-compatible mail posting interface.
# 
sendmail_path = /usr/sbin/sendmail

# newaliases_path: The full pathname of the Postfix newaliases command.
# This is the Sendmail-compatible command to build alias databases.
#
newaliases_path = /usr/bin/newaliases

# mailq_path: The full pathname of the Postfix mailq command.  This
# is the Sendmail-compatible mail queue listing command.
# 
mailq_path = /usr/bin/mailq

# setgid_group: The group for mail submission and queue management
# commands.  This must be a group name with a numerical group ID that
# is not shared with other accounts, not even with the Postfix account.
#
setgid_group = postdrop

# html_directory: The location of the Postfix HTML documentation.
#
html_directory = /usr/doc/postfix-2.10.2/html

# manpage_directory: The location of the Postfix on-line manual pages.
#
manpage_directory = /usr/man

# sample_directory: The location of the Postfix sample configuration files.
# This parameter is obsolete as of Postfix 2.1.
#
sample_directory = /etc/postfix

# readme_directory: The location of the Postfix README files.
#
readme_directory = /usr/doc/postfix-2.10.2/README_FILES
inet_protocols = ipv4

#smtpd_sasl_auth_enable = no
#broken_sasl_auth_clients = no
#smtpd_sasl_authenticated_header = no
user2925795
  • 159
  • 1
  • 9
Vladimir
  • 45
  • 1
  • 2
  • 4

5 Answers5

7

It is unclear which port you have used, if authentication was enabled in the MUA and how master.cf looks like

As you don't have a smtpd_recipient_restrictions setting in your config file, the default is used:

smptd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination

It seems the first two rules do not apply, and the last one matches (a temporary reject): Relay access denied.

Sending mails is now allowed for all authenticated users and the local machine (so all local programs that connect to localhost).

For a public mailserver please take a look at the tutorials/guidelines at postfix.org: Basic Configuration Readme. Yes, it's much, but your own public mailserver brings not only fun but also responsibility!

sebix
  • 4,175
  • 2
  • 25
  • 45
  • I fixed now works.... But mails don't recive on gmail, what is problem? for hotmail work fine.... – Vladimir Jul 12 '14 at 21:49
  • 2
    In the logs (`/var/log/mail.log`) you can see the error from gmail. Gmail uses several anti-spam-techniques, I guess gmail isn't trusting you yet. For a public mailserver please take a look at the tutorials/guidelines at http://www.postfix.org/BASIC_CONFIGURATION_README.html Yes, it's much, but your own public mailserver brings not only fun but also responsibility! If this was the correct answer, please accept it. – sebix Jul 13 '14 at 07:42
  • 1
    From the rejection message `454 4.7.1 : Relay access denied;`, looks like the [default value of `smtpd_relay_restriction`](http://www.postfix.org/postconf.5.html#smtpd_relay_restrictions) who rejecting the message. That's explain why there are no smptd_recipient_restrictions but the message still rejected – masegaloeh Feb 26 '15 at 07:15
  • 1
    @Vladimir If you have another question, ask another question. It is frowned upon here to get a question answered, then to reformulate another question in a comment as you do here. The Gmail issue OBVIOUSLY is a different issue. Treat it as such. – TomTom Jul 04 '15 at 12:25
1

You probably do, and should, have relay authentication turned on. This setting will prevent anonymous users from sending spam.

I'm assuming you are using a desktop client to send/receive email. Do you have login authentication enabled on the smtp server settings in your client? If not, then logging in to the server like this will probably solve your problem.

ericbond007
  • 76
  • 1
  • 6
1

I had a similar problem, noticed that outlook was changing incoming port to 993 automatically when I selected ssl but didn't change outgoing from 25. Manually change 25 to 465 for outgoing fixed it.

0

I spent the entire day troubleshooting this issue from an Outlook client. Outlook was configured as:

  • My outgoing server (SMTP) requires authentication.
  • Log on to incoming mail server before sending mail.

Turns out this is the incorrect configuration. It should be:

  • My outgoing server (SMTP) requires authentication.
  • Use same settings as my incoming mail server.

I only realized this was not a postfix configuration error when sending an email from Thunderbird was successful.

Making this change eliminated the relay error. I hope this helps someone else.

0

As with @sebix's answer,mention username as only "name" and email from as full email address in you client side. Maybe helpful for someone.enter image description here