LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-05-2015, 09:34 AM   #1
smecherel
Member
 
Registered: Jun 2008
Posts: 43

Rep: Reputation: 15
Postfix appends myhostname instead of mydomain


Hi everyone,
I'm not sure if this is the right place to ask, but I will give it a try (maybe some postfix admins read it).

I'm in the process of configuring a postfix server from scratch, and I have an issue when injecting mails locally from cli.
The real domainname is replaced by mydomain.com

When I try to do this (logged in as username cosmin):
echo "Test" | mail -s Test someone@gmail.com
postfix says:
postfix/qmgr[10274]: 4FAE7B407D4: from=<cosmin@srv.mydomain.com>
And of course the email is delivered as coming from cosmin@srv.mydomain.com instead of cosmin@mydomain.com
This is not what I want, i want that for local users who inject emails from cli, the FROM part to be build adding $mydomain instead of $myhostname.

From reading postfix docs, I assumed that this will be the right config for that (definition of myorigin: The domain name that locally-posted mail appears to come from, and that locally posted mail is delivered to):
myorigin = $mydomain
mydomain = mydomain.com

But it does not work like I expected. So my question is: does anyone know what needs to be change so that when i send mail from cli on the postfix server, the domain is automatically appended to the user?


OS/server config:
Ubuntu 14.04, postfix 2.11 (everything installed from repositories with apt-get).


Below the full postconf -n:

cosmin@srv:/etc/postfix$ postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = $mydomain, srv.mydomain.com, srv, localhost.localdomain, localhost
mydomain = mydomain.com
myhostname = srv.mydomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname Email server - every action is logged
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
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_gid_maps = static:3000
virtual_mailbox_base = /home/cosmin/MAIL
virtual_mailbox_domains = alexinfo.ro
virtual_mailbox_maps = mysql:/etc/postfix/vmboxmaps.sql.cf
virtual_uid_maps = mysql:/etc/postfix/vuidmaps.sql.cf


Update:
I even tried with: "append_dot_mydomain = yes" but no success.
 
Old 08-07-2015, 10:10 AM   #2
auge
Member
 
Registered: May 2002
Location: Germany
Distribution: CentOS, Debian, LFS
Posts: 100
Blog Entries: 1

Rep: Reputation: Disabled
This is all on the same machine? Then set myhostname = $mydomain and you are done.
 
Old 08-07-2015, 10:15 AM   #3
auge
Member
 
Registered: May 2002
Location: Germany
Distribution: CentOS, Debian, LFS
Posts: 100
Blog Entries: 1

Rep: Reputation: Disabled
Because perhaps you are a nice guy, here more info: in main.cf:
smtp_generic_maps = hash:/etc/postfix/smecherelsmap
Save and close main.cf now open: /etc/postfix/smecherelsmap
cosmin@srv.mydomain.com cosmin@mydomain.com
Save and close the file. On the shell type:
postmap /etc/postfix/smecherelsmap && /etc/init.d/postfix restart
 
Old 08-10-2015, 12:52 PM   #4
smecherel
Member
 
Registered: Jun 2008
Posts: 43

Original Poster
Rep: Reputation: 15
Hi auge,
Sorry for this late response, yes, that is all on the same machine, and I think that what you showed me is just a trick, I already knew some tricks in order to modify he sender the way I wanted to. The real problem is that even though postfix was configured already ok, the client that I used from CLI (namely "mail" command) instead of honoring postfix configuration it automatically appends by itself @hostaname. Other mail clients (like sendmail) do not have this issue, I mean they append @domain correctly. So 2 solution are valid for this, either use mail with -a switch (I think) for changing the sender however you like, or use something else like sendmail.
 
Old 08-12-2015, 10:39 AM   #5
auge
Member
 
Registered: May 2002
Location: Germany
Distribution: CentOS, Debian, LFS
Posts: 100
Blog Entries: 1

Rep: Reputation: Disabled
@smerechel, you insist on using the different hostname there although that is the only mail-host and standalone mailserver for that domain. Postfix works that way. It is really no trick. Set mydomain = myhostname or map it, both shown above.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix-Squirrelmail: Mail sent to user1@mydomain.com delivered to user2@mydomain.com tsouvalasi Linux - Server 4 02-26-2010 08:15 AM
Weird postfix problem with virtual mailboxes and myhostname cojones Linux - Server 1 08-18-2009 09:06 AM
Postfix Appends FQDN to Senders Address carlosinfl Linux - Server 1 05-17-2009 08:57 PM
what's with the $myhostname and $mydomain on a linux box urentity Linux - Newbie 5 01-28-2009 10:07 AM
POSTFIX - user@host.mydomain.com - why? bryman55 Linux - Software 1 08-17-2003 12:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration