Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

If Attachment THEN AutoRespond

Discussion in 'E-mail Discussion' started by RiversideKid, Jun 9, 2019.

  1. RiversideKid

    RiversideKid Registered

    Joined:
    Sep 23, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Is it possible to send an auto reply to senders who send in email attachments, even if this is a cron job?

    -Stephen
     
  2. keat63

    keat63 Well-Known Member

    Joined:
    Nov 20, 2014
    Messages:
    1,291
    Likes Received:
    91
    Trophy Points:
    28
    cPanel Access Level:
    Root Administrator
    I can't see how you would do this with an auto responder, so I looked at filters, but i'm not sure you could do it with a filter either.
    A filter would only respond with a fail message.
     
  3. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,459
    Likes Received:
    503
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Actually this might be possible with some work - you may be able to use the exim system filter to do this and you might be able to sample the code for filtering dangerous attachments.

    To customize the exim system filter we have the following documentation:

    How to Customize the Exim System Filter File - cPanel Knowledge Base - cPanel Documentation

    To filter dangerous attachments we have the following in the exim system filter (keep in mind this is an example I'm not suggesting you actually modify this part of the system filter just add a new part sampling this code) :

    Code:
    # Look for single part MIME messages with suspicious name extensions
    # Check Content-Type header using quoted filename [content_type_quoted_fn_match]
    if $header_content-type: matches "(?:file)?name=(\"[^\"]+\\\\.(?:ad[ep]|ba[st]|chm|cmd|com|cpl|crt|eml|exe|hlp|hta|in[fs]|isp|jse?|lnk|md[be]|ms[cipt]|pcd|pif|reg|scr|sct|shs|url|vb[se]|ws[fhc])\")"
    then
      fail text "This message has been rejected because it has\n\
             potentially executable content $1\n\
             This form of attachment has been used by\n\
                 recent viruses or other malware.\n\
             If you meant to send this file then please\n\
             package it up as a zip file and resend it."
      seen finish
    endif
    # same again using unquoted filename [content_type_unquoted_fn_match]
    if $header_content-type: matches "(?:file)?name=(\\\\S+\\\\.(?:ad[ep]|ba[st]|chm|cmd|com|cpl|crt|eml|exe|hlp|hta|in[fs]|isp|jse?|lnk|md[be]|ms[cipt]|pcd|pif|reg|scr|sct|shs|url|vb[se]|ws[fhc]))([\\\\s;]|\\$)"
    then
      fail text "This message has been rejected because it has\n\
             potentially executable content $1\n\
             This form of attachment has been used by\n\
                 recent viruses or other malware.\n\
             If you meant to send this file then please\n\
             package it up as a zip file and resend it."
      seen finish
    endif
    You'd have to modify the regex in header_content-type to match the types of attachments you'd want to filter then instead of fail you'd want to autorespond so you'd need to decide if you're delivering to the original intended recipient or failing
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice