postfix reject invalid email ids

namratab
2013-07-01
2013-07-01
  • namratab

    namratab - 2013-07-01

    Hello , I need postfix to reject email ids which do not have a domain name ... for example if the email address is just abc....and there is no @domainname after that . I have found articles where you can reject certain domain names but none to reject emails without a domain . Any help for the same is greatly appreciated .

     
  • Simon Hobson

    Simon Hobson - 2013-07-01

    Firstly, this is the help forum for Postfix Admin - a package for managing virtual domains and mailboxes. For Postfix specific help you'd be better over at postfix.org.

    But you need to clarify what you mean by the rather vague term "email id". If you mean sender email address then say so ! If you do, then I suggest you look at http://www.postfix.org/postconf.5.html#smtpd_sender_restrictions and I think you'll find reject_non_fqdn_sender and reject_unknown_sender_domain quite effective. The first rejects any sender that isn't "user@domain.tld", the second will reject messages where domain.tld doesn't exist.
    There are similar restrictions for smtpd_recipient_restrictions.

    Here's the relevant sections from main.cf for my server (x.x.x.x hosts a PolicyD server (aka ClueBringer) which does quotas and greylisting). Between the greylisting, and the restrictions specified below, the bulk of the spam is stopped before it gets to see Amavis. By the time you've looked up what the various bits do, I think you'll have a good handle on things.

    # Requirements for the HELO statement
    smtpd_helo_restrictions =
        check_client_access cidr:/etc/postfix/host_access,
        permit_mynetworks,
        permit_sasl_authenticated,
        check_helo_access hash:/etc/postfix/helo_access,
        reject_non_fqdn_hostname,
        warn_if_reject reject_invalid_hostname,
        permit
    
    # Requirements for the sender details
    smtpd_sender_restrictions =
        check_client_access cidr:/etc/postfix/host_access,
        permit_mynetworks,
        hash:/etc/postfix/access,
        permit_sasl_authenticated,
        reject_non_fqdn_sender,
        reject_unknown_sender_domain,
        reject_unauth_pipelining,
        permit
    
    ## Requirements for the connecting server
    smtpd_client_restrictions =
        permit_mynetworks,
        check_client_access cidr:/etc/postfix/blacklist,
        permit
    
    # Requirement for the recipient address
    smtpd_recipient_restrictions =
        permit_mynetworks,
        reject_unauth_pipelining,
        check_client_access cidr:/etc/postfix/host_access,
        check_policy_service inet:x.x.x.x:10031,
        permit_sasl_authenticated,
        reject_non_fqdn_recipient,
        reject_unknown_recipient_domain,
        reject_unlisted_recipient,
        reject_unauth_destination,
        reject_unauth_pipelining,
        permit
    
    smtpd_end_of_data_restrictions =
        check_policy_service inet:x.x.x.x:10031,
        permit
    
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks