Search code examples
smtpsubdomainpostfix-mtahostnamesquirrelmail

Postfix sending mail from hostname


heey all,

I'm having a question regarding postfix and how it sends mail. I've set up correctly and i'm able to send mail which doesn't end up in spam.

But for some reason when i show details of the mail (on gmail for example) it shows this a sender address: [email protected]

I want this to become [email protected] How would i do such a thing?

Another question from me is how would one encrypt the email? Without it going directly to the spam folder?

I'm using mailutils to send my mail as squirrelmail somehow can't send my mail. Yet squirrelmail can view the mail. I'm using Debian Jessie as my server

My postfix main file:

myhostname = mail.domain.com
mydomain = domain.com
myorigin = $mydomain
mydestination = $myhostname, $mydomain, localhost, localhost.$mydomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
relay_domains = $mydestination
syslog_name=postfix/submission

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

smtpd_tls_cert_file=/etc/letsencrypt/live/domain.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/domain.com/privkey.pem
smtpd_use_tls = yes
smtpd_tls_auth_only = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_security_level = may
#smtp_tls_security_level = may
smtpd_tls_protocols = !SSLv2, !SSLv3
smtpd_tls_wrappermode=no

smtpd_sasl_type=dovecot
smtpd_sasl_path=private/auth
smtpd_sasl_auth_enable=yes
milter_macro_daemon_name=ORIGINATING
#Security and Anti-Spam cinfig
policy-spf_time_limit = 3600s
smtpd_helo_required = yes

smtpd_recipient_restrictions =
 reject_non_fqdn_recipient
 reject_unknown_recipient_domain
 permit_mynetworks
 permit_sasl_authenticated
 reject_unauth_destination
 check_policy_service unix:private/policy-spf
 check_policy_service inet:127.0.0.1:10023

smtpd_helo_restrictions =
 permit_mynetworks
 reject_non_fqdn_helo_hostname
 reject_invalid_helo_hostname

smtpd_client_restrictions=
 permit_mynetworks
 permit_sasl_authenticated
 reject_unknown_client_hostname

smtpd_data_restrictions =
 reject_unauth_pipelining

#DKIM
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891

local_recipient_maps = proxy:unix:passwd.byname $alias_maps

Solution

  • I can only answer your first question, you'll want "Address Rewriting" rules, you can find here how to set them up:

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