How to manage postfix queue so that I'll send email just on request

Discussion in 'Server Operation' started by voltron81, Nov 24, 2009.

  1. voltron81

    voltron81 New Member

    Hi to everybody.
    I've create a main mailserver and a local mailserver.
    The local mailserver will relay all the emails to be sent to the main mailserver, that phisically do the job.
    The local mailserver will fetch the email arrived from the main mailserver with fetchmail.
    Now, this is the issue:
    I've setup the local mailserver so that every email to be sent is relay to the main mailserver. But I don't want that every email is relayed automatically... I want to use the queue of postfix and put all the email in "hold", so that, with a script, I'll send manually every email.

    How to setup the queue to put the emails in "hold" and not send them directly?

    Thanks
    Michele
     
  2. voltron81

    voltron81 New Member

    This is the main.cf that I've now:
    Code:
    # See /usr/share/postfix/main.cf.dist for a commented, more complete version
    
    
    # Debian specific:  Specifying a file name will cause the first
    # line of that file to be used as the name.  The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname
    
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h
    
    readme_directory = /usr/share/doc/postfix
    
    # TLS parameters
    smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_use_tls=yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    
    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.
    
    myhostname = hostname
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = hostname, localhost
    relayhost =
    
    #relayhost = [127.0.0.1]:11125  This is just if we have the SSH tunnel
    
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_command = procmail -a "EXTENSION" 
    mailbox_size_limit = 0
    recipient_delimiter = +
    
    inet_interfaces = all
    
    html_directory = /usr/share/doc/postfix/html
    
    
    virtual_alias_domains =
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_mailbox_base = /var/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    smtpd_sasl_authenticated_header = yes
    smtp_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, reject_unauth_destination
    smtpd_tls_security_level = may
    
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
    virtual_create_maildirsize = yes
    virtual_maildir_extended = yes
    virtual_mailbox_limit_maps = 
    virtual_mailbox_limit_override = 
    virtual_maildir_limit_message = 
    virtual_overquota_bounce = 
    
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    
    maildrop_destination_concurrency_limit = 1  
    maildrop_destination_recipient_limit = 1  
    virtual_transport = maildrop
    receive_override_option = no_address_mappings
    Suggestions?
    Thanks
    Michele
     
  3. voltron81

    voltron81 New Member

    After an afternoon on google I've found something what should be ok:
    -I'll add in master.cf:
    Code:
    hold unix - - n - - smtp
    -I'll add in main.cf this lines:
    Code:
    virtual_transport=hold
    default_transport=hold
    defer_transport=hold
    -in main.cf, where there is:
    Code:
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    I'll write in that database
    Code:
    hold:[mail.domain.com]
    instead of
    Code:
    smtp:[mail.domain.com]
    Now all the emails that I'll try to send from the local mailhost are queued in deferred transport and I've to send them manually.
    The only thing now is: how can I put all the email that I'll try to send to "hold" insted of "defer"?
    I know the command to do it one by one, but I would like to have this configuration directly by postfix...

    Thanks
    Michele
     
  4. voltron81

    voltron81 New Member

    Guys, for some reason with my configuration I can try to send email just with telnet 25 (SMTP), but If I'm trying to telnet the POP3 or IMAP, I've a login error...

    Any suggestions?

    Thanks
     
  5. Mark_NL

    Mark_NL Member

    nice monologue you're having here ;-)

    anyway, may i asked why you want a delay in sending email?
    you know how annoying that it? ;-)
     
  6. voltron81

    voltron81 New Member

    Yes it was a monologue... :p
    I need to make a queue of emails because this mailserver will be connected on internet with a very expensive connection...

    Any idea of why I'm having login error with POP3?

    Thanks
    Michele
     
  7. Mark_NL

    Mark_NL Member

    Check if those processes are running

    Code:
    netstat -tapn | grep ':25'
     
  8. voltron81

    voltron81 New Member

    Yes the processes are running:
    Code:
    tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      4747/master
    tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      2336/couriertcpd
    I can send email via telnet 25, but if I telnet 110, I can not login...
     
  9. Mark_NL

    Mark_NL Member

    check the logfiles for errors
     
  10. btomasik

    btomasik New Member

    What software are you using for pop3?
     
  11. Mark_NL

    Mark_NL Member

    i'd say courier :)

    Code:
    tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      2336/couriertcpd
     
  12. voltron81

    voltron81 New Member

    thanks guys, but I solved.
    It was a pop3 and IMAP certificate issue...

    Thanks
    Michele
     

Share This Page