HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   Sender Address Rewriting In Postfix! (http://www.howtoforge.com/forums/showthread.php?t=42492)

ojha_riddhish 8th January 2010 13:04

Sender Address Rewriting In Postfix!
 
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======raj@mail.myhomepc.com=====thinking_raj@ya hoo.com
ravi=====ravi@mail.myhomepc.com====ravi_lonedreame r@gmail.com
raghav===raghav@mail.myhomepc.com===raghav123@redi ffmail.com

Whenever, I send a message using raj's account, the From address and Reply-To address contains raj@mail.myhomepc.com or raj@homepc.com. But I want it to be rewritten to my original email_id, that is, thinking_raj@yahoo.com. 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 ravi_lonedreamer@gmail.com:ravi's_password

My generic file contains:

raj@mail.myhomepc.com==========thinking_raj@yahoo. com
raj@myhomepc.com=============thinking_raj@yahoo.co m
raj@localhost.myhomepc.com=======thi...aj@yaho o.com
raj@localhost=================thinking_raj@yahoo.c om
ravi@mail.myhomepc.com=========ravi_...er@gm ail.com
ravi@myhomepc.com============ravi_lo...er@gmai l.com
ravi@localhost.myhomepc.com======rav...er@ gmail.com
ravi@localhost================ravi_l...er@gma il.com
raghav@mail.myhomepc.com=======ragha...diffmai l.com
raghav@myhomepc.com==========raghav123@rediffmail. com
raghav@localhost.myhomepc.com====rag...diffm ail.com
raghav@localhost==============raghav...diffmail .com

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,


All times are GMT +2. The time now is 07:34.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.