Maybe someone here knows the answer. I went through various relay access denied postings but i still can't exactly figure out what i have configured incorrectly.

Mail from my terminal to my personal email account works (but it shows ec2-user@mail.domain.com, whereas i'd like it to come from ec2-user@domain.com. My mail server is called mail).

Likewise, when I send mail to ec2-user@domain.com, I get this message:

May 26 09:17:43 www postfix/smtpd[27620]: connect
    from mail-oln040092067035.outbound.protection.outlook.com[]
May 26 09:17:43 www postfix/smtpd[27620]: NOQUEUE: reject: RCPT
    from mail-oln040092067035.outbound.protection.outlook.com[]: 
    554 5.7.1 <ec2-user@domain.com>: Relay access denied; 
    from=<bla@outlook.com> to=<ec2-user@domain.com> 
    proto=ESMTP helo=<EUR02-AM5-obe.outbound.protection.outlook.com>

if I mail to the mail. With subdomain it works fine, both from my email client or from the terminal on the host itself. How can I send (and receive) mails from my entire domain? Is it a Postfix configuration thing?


Yes, it is a Postfix configuration thingy. It's Postfix Basic Configuration.

The mydestination parameter specifies what domains this machine will deliver locally, instead of forwarding to another machine. The default is to receive mail for the machine itself. See the VIRTUAL_README file for how to configure Postfix for hosted domains.

The error Relay access denied; suggests forwarding to another machine is used instead of local delivery, so you only have mail.$mydomain (possibly from $myhostname) in your mydestination.

You can check the current configuration with sudo postconf mydestination ( -d for showing default values). This way it's easier to know the actual value when the configuration file is longer, because:

When the same parameter is defined multiple times, only the last instance is remembered.

Otherwise, the order of main.cf parameter definitions does not matter.

Maintaining email servers is a complicated area. Let me be straight: if you have this kind of problems, you shouldn't do it yourself. Read through Why You May Not Want To Run Your Own Mail Server.

Quick summary: setting up and maintaining your own mail server is complicated and time-consuming, and there are several affordable alternatives—most people will get more value, in the form of saved time, out of using a paid mail service.

  • Hi Esa, thank you. I'm an experienced unix and network person, so despite me not being up to date with postfix configuration, i'm sure i can figure it out. I don't want to pay for mail services like mailgun or mailchimp, i dont have the money for it and it seems like something i can do myself. I'm aware of all the pitfalls. I've already cleaned my ip address of all blacklists. Quite frankly i think more people should run their own instead of resorting to commercial mail providers at the first sign of trouble. It might be complicated, but it is not rocket science either. I might be wrong. – ATv Jun 1 '17 at 11:34
  • I'm pretty sure i have my own domain included in the : mydestination = $myhostname, localhost.$mydomain $mydomain mydestination = $myhostname, localhost.$mydomain www.$mydomain, ftp.$mydomain list. Or is order important in that it would take the $myhostname first if it were before the $mydomain ? I probably don't have $mydomain in there separately if it is not configured by default, i will check and change that. Thank you. – ATv Jun 1 '17 at 11:36
  • Is that configuration literal? You shouldn't have two mydestination lines. When the same parameter is defined multiple times, only the last instance is remembered. The second line doesn't contain bare $mydomain. – Esa Jokinen Jun 1 '17 at 11:45
  • This is the $mydestination line: mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain – ATv Jun 2 '17 at 6:47
  • And this is my "SENDING MAIL" line: myorigin = $mydomain. I restarted postfix but mail still has the from address as www.mydomain.com. – ATv Jun 2 '17 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.