9

I am setting up a linux server that I want to send mail independently of our main mailserver (ie. directly). The problem is, when I send mail to an external address, it bounces with the message domain of sender address does not exist. (it is sending the mail as root@domain.local)

What is the proper way to change the domain of my email sender?

  • 1
    Setting $myorigin to our internet domain name appears to fix the problem - not sure if this is the "proper" way to do this. – Brent Jun 22 '09 at 19:54
  • 1
    Should work fine if you won't be changing it often. Other way is to set the hostname on the server to a valid mail domain name. – Dave Drager Jun 22 '09 at 19:55
9

In main.cf:

# 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 = $mydomain
myorigin = $myhostname

This is the default setup. If your hostname is domain.local this is probably why you are seeing that as sender domain.

  • correct, my hostname is domail.local (in this example) – Brent Jun 22 '09 at 19:50
4

You need to fix your domain name in the postfix configuration (domain.local is not a valid domain name).

Check /etc/postfix/main.cf, there are a few ways this can be specified, this may help: http://www.postfix.org/BASIC_CONFIGURATION_README.html#myorigin

4

This is one of those issues that you will need to involve/bribe/blackmail your DNS admin for assistance on as you will want the name your server claims when trying to send to be correct. Mnay servers will bounce your mail if the sender doesn't correctly resolve both forward and reverse.

For example, let's say your server is mail01.example.com. When your server, with the $myorigin correctly configured to advertise as mail01.example.com, contacts my server, my server will do a DNS lookup of of the IP address you're connecting from and will expect the lookup to match the name your giving me. If it does not correctly resolve, then I will sever the connection because you're probably just sending me spam.

  • +1 Nice & Clear explanation in the 2nd paragraph... – Ashish Oct 20 '16 at 11:07
1

You have to configure your postfix with smarthost because some destination servers verify if the sender address exists.

How to do it here: http://ubuntu.wordpress.com/2005/09/07/setting-a-smarthost-in-postfix/

  • Actually, this was how it WAS set up. This is a nagios server, and my goal is to remove its dependency on the mailserver (smarthost). Therefore, I need some way for it to send email directly to our admins via their external email addresses. – Brent Jun 22 '09 at 19:44
0

I have also faced above issue, After updating myorigin's value to the applicable domain name, Issue got resolved. Restart POSTFIX after updating.

myorigin= (EMAIL-DOMAIN).com

Example:

myorigin=yahoo.com
0

I had same issue ,the cause of this problem was relayhost allowing only mail from mydomain like "acme.com" and not from subdomains like "nagios.acme.com"

I fixed this by updating the "myorigin" parameters value to

myorigin = $mydomain
0

First and foremost to correctly set up a mail server so any and all mail you send doesn't get bounced you will need access to your resource records of your domain which are held at whatever DNS provider you have choosen, mine is Google

my resource records for better or worse

I will go over the resource records which is all you should need minus my dkim record which I will not be showing.

First is the actual DNS record.

Second is my CAA record that shows who holds my dns certificate so people can not spoof the DNS certificate.

Third is my MX record which tells everyone what mail server I use for my domain. You can have multiple of these with preference based on the integer before the address.

Fourth is my SPF record which tells all who look up my domain what ip addresses are authorized to send mail for my domain.pretty sure you can have multiple ip addresses or possibly even multiple SPF records.

Fifth is my DMARC record which tells mail exchanges what to do with mail not coming from IP addresses in the SPF record, or mail servers not in the MX records. You could possibly get away with creating this and just saying anything goes instead of reject, but still this is the right way.

Sixth would be my DKIM record which is a rsa key that is used to authenticate all mail coming from my domain, and is particularly a pain to get right.

Having done all of that you can then modify the origin configuration and all exchanges will accept your mail with bells and whistles on, as you will pass all three checks like so if you click original message in gmail.

enter image description here

Here is postfix's not so basic, basic configuration

http://www.postfix.org/BASIC_CONFIGURATION_README.html

Here is the documentation from opendkim, otherwise known as domainkeys identified mail, for your dkim server you probably will want eventually.

http://www.opendkim.org/docs.html

And here are some links about MX SPF and DMARC records, otherwise known as mail exchanger, sender policy framework, and
domain-based message authentication reporting and conformance respectively.

https://en.m.wikipedia.org/wiki/DMARC

https://en.m.wikipedia.org/wiki/Sender_Policy_Framework

https://en.m.wikipedia.org/wiki/MX_record

This is all required if you want your emails to be official and accepted by all, and is also good practice to help cut down on the spam/phish/malware in the world.

Also I may have not shown my dkim because it contains a key and is public record just not comfortable with that, but it is also a resource record held at your dns provider like the others that I showed.

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.