LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to change Postfix return-path (https://www.linuxquestions.org/questions/linux-server-73/how-to-change-postfix-return-path-847333/)

KPryor 11-29-2010 07:24 PM

How to change Postfix return-path
 
I just set up an internal mail server for my office using Postfix, Dovecot and Squirrelmail. It works great except for one tiny problem. When I send mail, I address it to user@myoffice (no .com, .net, etc) and it works perfectly. However, somewhere in my work, I screwed up and for whatever dumb reason put myoffice.net somewhere in there and now the return-path always shows up as user@myoffice.net instead of just user@myoffice. Does anyone know how to fix the return-path so that when someone clicks reply it goes to user@myoffice? I've Googled and searched here without finding my answer, apologies if it's out there and I've just failed to see it. Rest assured I have done a couple hours of searching before finally asking for help.

Thank you!
KP

carlosinfl 11-29-2010 07:32 PM

Can you please post the compete output of 'postconf -n' here so we can review your configuration?

Also it wouldn't hurt to see your '/etc/hosts' file as well.

KPryor 11-29-2010 07:44 PM

Hello, thank you for the reply. Here is postconf -n

Quote:

root@myoffice:/# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
default_transport = error
inet_interfaces = loopback-only
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = myoffice, localhost.localdomain, localhost
myhostname = myoffice
readme_directory = no
recipient_delimiter = +
relay_transport = error
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
And here is my /etc/hosts

Quote:

root@myoffice:/# less /etc/hosts
127.0.0.1 localhost
127.0.1.1 myoffice

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

carlosinfl 11-29-2010 08:40 PM

I don't know what your servers FQDN is but regardless if it's only internal and doesn't have a .tld, it's still a factor. So your config looks like it's missing some parameters where you problems appears to be coming from:

You're missing or need to correct:

mydomain = foo.com
myhostname = mail.foo.com
myorigin = foo.com
mydestination = $myhostname localhost.$mydomain localhost

Make those configuration changes in '/etc/postfix/main.cf' & run 'postfix reload' and let me know. Hope that helps!

Below is my configuration you can try and use for a reference. Be sure to backup your old before you make ANY changes:

# Paths
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
mail_owner = postfix
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
manpage_directory = /usr/share/man
sample_directory = /etc/postfix/sample

# Domain settings
myhostname = mail.mydomain.tld
mydomain = mydomain.tld
myorigin = $mydomain
mydestination = $myhostname, $mydomain, mail.$mydomain

# TLS settings
smtpd_tls_security_level = may
smtpd_tls_cert_file = /
smtpd_tls_key_file = /
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache
smtpd_tls_loglevel = 2

# Network settings
inet_interfaces = all
inet_protocols = ipv4
mynetworks = $config_directory/mynetworks
relayhost =

# Email and mailbox settings
alias_maps = hash:/etc/postfix/aliases
alias_database = $alias_maps
home_mailbox = mail/
message_size_limit = 20480000

# SMTP settings
smtpd_recipient_restrictions =
permit_mynetworks,
reject_unauth_destination,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_non_fqdn_helo_hostname,
reject_invalid_helo_hostname,
reject_rbl_client zen.spamhaus.org,
reject_rbl_client bl.spamcop.net,
check_client_access
hash:/etc/postfix/client_access

smtpd_sender_restrictions =
permit_mynetworks

# Misc
recipient_delimiter = +

KPryor 11-29-2010 09:05 PM

Thanks for the info. Unfortunately, it's still doing the same thing. However, I found a work-around I hadn't thought of. Something I should have thought of all along. I just need to go into the options in the squirrelmail and it has a place where you can set your reply-to address. It isn't perfect, as I'll have to go into every users options and do this, but at least it will work. I just can't figure out where the ".net" is being pulled from to put in the return-path. Very strange.
Thanks!
KP

KPryor 11-29-2010 09:38 PM

Never mind, I found it!!! /etc/mailname was the answer. Thanks for your assistance!
KP

carlosinfl 11-30-2010 07:15 AM

Oh I didn't know you were using Debian or Ubuntu. Yes, '/etc/mailname' is the problem and Postfix reads straight from that file. I still recommend adding or adjusting your main.cf as posted above but glad it was sorted out and everything's working.

KPryor 11-30-2010 10:57 AM

Yes, I probably should have mentioned what distro I was using, sorry about that.
I will definitely do what you suggest with my main.cf.

Thank you so much for your help!
KP


All times are GMT -5. The time now is 10:23 AM.