Sender Address Rewriting In Postfix!

Discussion in 'Server Operation' started by ojha_riddhish, Jan 8, 2010.

  1. ojha_riddhish

    ojha_riddhish New Member

    Dear friends,

    I am here with a typical problem with my home email server. I hope anyone of you would have exerienced the same problem I'm experiencing currently. Please help me or guide me if somebody knows something about it. Thanks in advance!
    My requirement:
    I want a mail server that can relay mails to the internet using GMail and fetch the mails of different accounts into the mail server and distribute them to their respective users. I am using Postfix, Fetchmail and Dovecot. I have a PC with 3 users. My father, brother and I use the PC having Ubuntu 9.04 and share the internet. We all send mail and retrieve mail. We do use Evolution and Mutt sometimes. We want to send our mails with our email_ids without even logging in.

    Hostname
    mail.myhomepc.com

    Domain
    myhomepc.com

    User====LocalEmail_ID===========Email_ID
    raj======[email protected]=====[email protected]
    ravi=====[email protected]====[email protected]
    raghav===[email protected]===[email protected]

    Whenever, I send a message using raj's account, the From address and Reply-To address contains [email protected] or [email protected]. But I want it to be rewritten to my original email_id, that is, [email protected]. But somehow this is not happening.

    My main.cf file contains:

    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    append_dot_mydomain = no
    readme_directory = no
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myhostname = mail.myhomepc.com
    myorigin = /etc/mailname
    mydestination = myhomepc.com, mail.myhomepc.com, localhost.myhomepc.com, localhost
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    inet_protocols = all
    smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
    broken_sasl_auth_clients = yes
    smtp_tls_CAfile = /etc/postfix/cacert.pem
    smtp_tls_cert_file = /etc/postfix/MyHomePC-cert.pem
    smtp_tls_key_file = /etc/postfix/MyHomePC-key.pem
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtpd_tls_CAfile = /etc/postfix/cacert.pem
    smtpd_tls_cert_file = /etc/postfix/MyHomePC-cert.pem
    smtpd_tls_key_file = /etc/postfix/MyHomePC-key.pem
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    tls_random_source = dev:/dev/urandom
    smtpd_sasl_auth_enable = no
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtpd_sasl_local_domain = $myhostname
    smtp_sasl_security_options = noanonymous
    smtp_sasl_tls_security_options = noanonymous
    smtpd_sasl_application_name = smtpd
    smtp_tls_per_site = hash:/etc/postfix/tls_per_site
    relayhost = [smtp.gmail.com]:587
    disable_dns_lookups = yes
    smtp_generic_maps = hash:/etc/postfix/generic
    transport_maps = hash:/etc/postfix/transport

    My sasl_passwd file contains:

    [smtp.gmail.com]:587 [email protected]:ravi's_password

    My generic file contains:

    [email protected]==========[email protected]
    [email protected]=============[email protected]
    [email protected]=======[email protected]
    raj@localhost=================[email protected]
    [email protected]=========[email protected]
    [email protected]============[email protected]
    [email protected]======[email protected]
    ravi@localhost================[email protected]
    [email protected]=======[email protected]
    [email protected]==========[email protected]
    [email protected]====[email protected]
    raghav@localhost==============[email protected]

    A part of my master.cf file contains:

    relay unix - - - - - smtp
    -o smtp_generic_maps=
    -o smtp_fallback_relay=


    I have created my custom certificate using SSL. I've created the Postfix's main.cf file following a tutorial on the net. Currently mails are going fine, but with our local email_ids. I want Postfix to rewrite our local email_ids with the equivalent email_id on the net. I know that it's possible, but somehow I can't figure it out. Please help me in either correcting the wrong configuration on my part or guiding me to achieving what I require. Thanks in advance!

    Thanks & Regards,
     

Share This Page