Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Email Forwarding

  1. #1
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Email Forwarding

    I have searched to no avail. I cannot seem to figure out how to add a forward to my current setup. I used this to get it up and running, and a combo of posts to add SpamAssasin+Procmail. I have 2 domains for email, one that is actually hosted on my server and the other which is supposed to be a catch-all-and-forward.
    Here is my configs:
    POSTFIX
    main.cf
    Code:
    ## MISCsmtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    append_dot_mydomain = no
    readme_directory = no
    recipient_delimiter = +
    mailbox_size_limit = 0
    
    
    ## AUTH & SECURITY
    smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem
    smtpd_tls_key_file=/etc/ssl/private/dovecot.pem
    smtpd_use_tls=yes
    smtpd_tls_auth_only = yes
    smtpd_sasl_type = dovecot
    smtpd_sasl_path = private/auth
    smtpd_sasl_auth_enable = yes
    smtpd_recipient_restrictions =
       permit_sasl_authenticated,
       permit_mynetworks,
       reject_unauth_destination
    
    
    ## IP ADDRESSES & DOMAIN NAMES
    myhostname = mail.twprogrammers.com
    myorigin = /etc/mailname
    mydestination = localhost
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    inet_interfaces = all
    
    
    ## VIRTUAL USERS, MAILBOXES, ALIASES, ECT.
    
    
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    virtual_transport = procmail
    virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
    virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
    master.cf
    Code:
    smtp  inet  n   -   -   -   -   smtpdpickupfifo  n   -   -   60  1   pickup
    cleanup   unix  n   -   -   -   0   cleanup
    qmgr  fifo  n   -   n   300 1   qmgr
    tlsmgrunix  -   -   -   1000?   1   tlsmgr
    rewrite   unix  -   -   -   -   -   trivial-rewrite
    bounceunix  -   -   -   -   0   bounce
    defer unix  -   -   -   -   0   bounce
    trace unix  -   -   -   -   0   bounce
    verifyunix  -   -   -   -   1   verify
    flush unix  n   -   -   1000?   0   flush
    proxymap  unix  -   -   n   -   -   proxymap
    proxywrite unix -   -   n   -   1   proxymap
    smtp  unix  -   -   -   -   -   smtp
    relay unix  -   -   -   -   -   smtp
    showq unix  n   -   -   -   -   showq
    error unix  -   -   -   -   -   error
    retry unix  -   -   -   -   -   error
    discard   unix  -   -   -   -   -   discard
    local unix  -   n   n   -   -   local
    virtual   unix  -   n   n   -   -   virtual
    lmtp  unix  -   -   -   -   -   lmtp
    anvil unix  -   -   -   -   1   anvil
    scacheunix  -   -   -   -   1   scache
    procmail  unix  -   n   n   -   -   pipe
      flags=RO user=vmail argv=/usr/bin/procmail -t -m USER=${user}
      EXTENSION=${extension} RECIPIENT=${recipient} /etc/procmail/main.rc
    uucp  unix  -   n   n   -   -   pipe
      flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
    ifmailunix  -   n   n   -   -   pipe
      flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
    bsmtp unix  -   n   n   -   -   pipe
      flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
    scalemail-backend unix-nn-2pipe
      flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
    mailman   unix  -   n   n   -   -   pipe
      flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
      ${nexthop} ${user}
    mysql-virtual-alias-maps.cf
    Code:
    user = mailuser
    password = REMOVED
    hosts = 127.0.0.1
    dbname = mailserver
    query = SELECT IFNULL(a.destination,u.email) AS destination FROM virtual_aliases a INNER JOIN virtual_users u ON a.destination=u.email WHERE a.source='%s' OR u.email='%s'
    mysql-virtual-mailbox-maps.cf
    Code:
    user = mailuser
    password = REMOVED
    hosts = 127.0.0.1
    dbname = mailserver
    query = SELECT 1 FROM virtual_users WHERE email='%s'
    mysql-virtual-mailbox-domains.cf
    Code:
    user = mailuser
    password = REMOVED
    hosts = 127.0.0.1
    dbname = mailserver
    query = SELECT 1 FROM virtual_domains WHERE name='%s'
    MYSQL
    virtual_aliases
    id domain_id source destination
    1 1 REMOVED@twprogrammers.com REMOVED@twprogrammers.com
    2 1 REMOVED@twprogrammers.com REMOVED@twprogrammers.com
    3 1 REMOVED@twprogrammers.com REMOVED@twprogrammers.com
    100 1 @twprogrammers.com REMOVED@twprogrammers.com
    101 3 @hawkladybeadery.com REMOVED@satx.rr.com
    virtual_domains
    id name
    1 twprogrammers.com
    2 mail.twprogrammers.com
    3 hawkladybeadery.com
    4 mail.hawkladybeadery.com
    virtual_users
    id domain_id password email
    1 1 HASHEDPASS REMOVED@twprogrammers.com
    2 1 HASHEDPASS REMOVED@twprogrammers.com
    3 1 HASHEDPASS REMOVED@twprogrammers.com
    What am I doing wrong? How can I fix it so that all mail to hawkladybeadry.com is forwarded to the satx.rr.com address?


    EDIT:
    When I send a message to say -- test@hawkladybeadery.com it bounces back with this:
    This Message was undeliverable due to the following reason:

    Each of the following recipients was rejected by a remote mail server.
    The reasons given by the server are included to help you determine why
    each recipient was rejected.

    Recipient: <test@hawkladybeadery.com>
    Reason: 5.1.1 <test@hawkladybeadery.com>: Recipient address rejected:
    User unknown in virtual mailbox table


    Please reply to <Postmaster@email.rr.com>
    if you feel this message to be in error.
    Open Attachment: []
    --- Forwarded Message ---
    Date:
    [{DATE}]
    From: {FROM}
    To: test@hawkladybeadery.com
    Subject: {SUBJECT}
    {MESSAGE}
    Last edited by wolfgentleman; March 19th, 2014 at 11:23 PM. Reason: Added the bounce message

    Sincerely,
    Patrick Thomas (Timberwolf)


  2. #2
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Email Forwarding

    Are you sure your server is allowed to send mail to that satx.rr.com address? I have mine set up to forward mail from one of my domains to another domain but that domain is on the same mail server..

    Everything looks right to me, though.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  3. #3
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Email Forwarding

    Quote Originally Posted by CharlesA View Post
    Are you sure your server is allowed to send mail to that satx.rr.com address?
    Oh, I am sorry I forgot to add the bounce message! Adding it now.

    Sincerely,
    Patrick Thomas (Timberwolf)


  4. #4
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Email Forwarding

    Try changing the alias to send it to an address on the same server and see if you get the same error back.

    I'm guessing the catchall isn't working properly.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  5. #5
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Email Forwarding

    Quote Originally Posted by CharlesA View Post
    Try changing the alias to send it to an address on the same server and see if you get the same error back.

    I'm guessing the catchall isn't working properly.
    Ok, I just did and it went through... So... do I need to add the email to virtual_users and satx.rr.com to virtual_domains? Will try that and report tomorrow.

  6. #6
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Email Forwarding

    The only issue I see with doing that is the mail server could accept mail for satx.rr.com, whether that is a real issue or not, I do not know.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  7. #7
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Email Forwarding

    Quote Originally Posted by CharlesA View Post
    The only issue I see with doing that is the mail server could accept mail for satx.rr.com, whether that is a real issue or not, I do not know.
    Well... it delivered to the void... Tried poking around in /var/mail/vhosts to see if procmail delivered it like that, but no go. Also looked @ mail logs in /var/log and it shows no sign of it being received.

  8. #8
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Email Forwarding

    bump

  9. #9
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Email Forwarding

    Where are the procmailrc files in this setup? With virtual users, what's the equivalent of $HOME/.procmailrc?

    The reason I ask is that you can do forwardings there as well. One solution to your problem might be to create a recipe in the system-wide /etc/procmailrc like this:
    Code:
    :0
    * ^TO.*hawkladybeardery
    ! removed@satx.rr.com
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  10. #10
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Email Forwarding

    Quote Originally Posted by SeijiSensei View Post
    Where are the procmailrc files in this setup? With virtual users, what's the equivalent of $HOME/.procmailrc?
    I have a folder structure in /etc/procmail/ that looks like this:
    /etc/procmail/main.rc
    /etc/procmail/spam.rc
    /etc/procmail/filters/$USER/pre.rc
    /etc/procmail/filters/$USER/post.rc

    In main.rc it makes the declarations of $USERNAME and $DELIVER then INCLUDERC=/etc/procmail/filters/$USER/pre.rc then INCLUDERC=/etc/procmail/spam.rc then INCLUDERC=/etc/procmail/filters/$USER/post.rc then delivers everything else to the inbox with $DELIVER -u $USERNAME
    Some of the above may be inaccurate as I am not looking at the rc file at this very moment, however I think I got it.

    Quote Originally Posted by SeijiSensei View Post
    The reason I ask is that you can do forwardings there as well. One solution to your problem might be to create a recipe in the system-wide /etc/procmailrc like this:
    Code:
    :0
    * ^TO.*hawkladybeardery
    ! removed@satx.rr.com
    I will try this in a few minutes and update my post.

    Update:
    Using the above it delivered it to the 'void'. Not sure what is going on there... nothing shows in the logs, not even postfix's. The MX records seem to be in proper order. I guess now I just wait for it to cough up at me with a post master error. :-/
    Last edited by wolfgentleman; May 14th, 2014 at 08:23 PM.

    Sincerely,
    Patrick Thomas (Timberwolf)


Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •