IMAP importing spam folder

Moderator: crythias

Post Reply
arvas
Znuny newbie
Posts: 44
Joined: 15 Oct 2012, 09:08
Znuny Version: 3.0.11

IMAP importing spam folder

Post by arvas »

Hi guys,

Is there any way to subscribe to additional folders when using imap?
Last edited by arvas on 03 Mar 2013, 07:32, edited 2 times in total.
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: IMAP importing spam folder

Post by crythias »

Why bother? The otrs email box isn't for humans; there's no need for it to have folders.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
arvas
Znuny newbie
Posts: 44
Joined: 15 Oct 2012, 09:08
Znuny Version: 3.0.11

Re: IMAP importing spam folder

Post by arvas »

isent for humans? no wonder people complain when i put them to use otrs... ;)
well i set up spam assassin to put spam into a box called spam. I want to retrieve the email inside this folder as there is a possibility of getting normal emails inside spam as well
for otrs we can say put the spam folder from the email account into the spam queue i suppose?
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: IMAP importing spam folder

Post by reneeb »

In that case, SpamAssassin shouldn't move the mail to a "spam" folder. As far as I know, SpamAssassin adds some mail headers. So you can leave the mail in the standard INBOX and use a PostMaster filter to move the ticket to the spam queue.

The PostMaster filter can check for the mail headers set by SpamAssassin.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: IMAP importing spam folder

Post by crythias »

the *email* box isn't for humans.. :) It's just a collection device in case you can't receive email directly to the OTRS box.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
arvas
Znuny newbie
Posts: 44
Joined: 15 Oct 2012, 09:08
Znuny Version: 3.0.11

Re: IMAP importing spam folder

Post by arvas »

raneebs right.... my host said that the folders would 'auto create' in the other email accounts when spam would be sent, it seems that this is not true as after 2 days there is no new folder.

Thanks for the time in assisting me everyone!

P.S. crythias you are making me curious on this 'box' :lol:
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: [SOLVED]IMAP importing spam folder

Post by crythias »

curious? You mean how to receive emails directly to otrs? Easy: if you have an smtp server on otrsserver that can receive emails otrs@otrsserver you don't need to fetch them.
Add and enable procmail (I hear that's optional, but it's about zero overhead).
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
arvas
Znuny newbie
Posts: 44
Joined: 15 Oct 2012, 09:08
Znuny Version: 3.0.11

Re: IMAP importing spam folder

Post by arvas »

Hey crythias,

procmail sounds great, live polling and all, but my system is on a windows. Will definitely use it once i get a linux server though!

as for my folder problem, there were some settings on the host which were lacking. They have now been done and my email accounts have a new folder called spam and ham. However OTRS is only receiving emails from the Inbox and not these other 2 folders. Did some searching but could not find much.

The only clue i did find was http://doc.otrs.org/3.0/en/html/email-receiving.html
But this seems to hint that the connection is having problems, which it is not so i do not think its appropriate.

in my settings i changed the email type to imap and to the right server url. The server can be pinged and the host has verified its correct.

Any ideas?
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: IMAP importing spam folder

Post by crythias »

My only suggestion is to use pop3 instead.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
arvas
Znuny newbie
Posts: 44
Joined: 15 Oct 2012, 09:08
Znuny Version: 3.0.11

Re: IMAP importing spam folder

Post by arvas »

i did a test but in either pop3 or imap OTRS is only downloading the main inbox folder and not the sub folders...
from what i understand the only way to download the extra folders is by IMAP as POP3 does not support this, but i am unsure how to instruct OTRS to download these extra folders
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: IMAP importing spam folder

Post by reneeb »

You have to change Kernel/System/MailAccount/IMAP.pm to achieve this.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
arvas
Znuny newbie
Posts: 44
Joined: 15 Oct 2012, 09:08
Znuny Version: 3.0.11

Re: IMAP importing spam folder

Post by arvas »

hey reneeb,

i think i found the line i need to change:

1) my $NOM = $IMAPObject->select('INBOX')
looks like this is the download

2)$IMAPObject->expunge_mailbox('INBOX');
looks like this is the delete command after downloading

So isit ok if i change it to
my $NOM = $IMAPObject->select('INBOX,spam,ham')
$IMAPObject->expunge_mailbox('INBOX,spam,ham');

or should i have 1 command per folder like
my $NOM = $IMAPObject->select('INBOX')
my $NOM = $IMAPObject->select('spam')
my $NOM = $IMAPObject->select('ham')
arvas
Znuny newbie
Posts: 44
Joined: 15 Oct 2012, 09:08
Znuny Version: 3.0.11

Re: IMAP importing spam folder

Post by arvas »

any help here?
Im on a live machine so i dont feel safe experimenting.. :|
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: IMAP importing spam folder

Post by crythias »

arvas wrote:my $NOM = $IMAPObject->select('INBOX')
my $NOM = $IMAPObject->select('spam')
my $NOM = $IMAPObject->select('ham')
This won't work:
1) You're redefining the variable $NOM (only the last will take)
2) You aren't terminating with semicolons
3) You only need "my" on the first time you implement a variable ($NOM). Afterwards, perl knows the scope of the variable.


The best way to do this is to not have folders. But if you *have* to, you will need to wrap your list

Code: Select all

    my $IMAPObject = $Connect{IMAPObject};
    my $NOM = $IMAPObject->select($IMAPFolder) || 0;
becomes

Code: Select all

    my $IMAPObject = $Connect{IMAPObject};
    my @IMAPFolders=("INBOX", "spam", "ham"); #get a list
    foreach $IMAPFolder (@IMAPFolders)  #iterate the list
{ #opening brace
    my $NOM = $IMAPObject->select($IMAPFolder) || 0;
and you will need a closing brace before #log status:

Code: Select all

    }

    # log status
    if ( $Debug > 0 || $FetchCounter ) {
becomes

Code: Select all

    }
} #close brace for foreach
    # log status
    if ( $Debug > 0 || $FetchCounter ) {
Not tested. May have bugs/spelling errors. Won't survive updates. Use at own risk.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: IMAP importing spam folder

Post by crythias »

btw, this didn't take into account "expunge" ... so you'll need to determine if this is going to download imap again and again.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
arvas
Znuny newbie
Posts: 44
Joined: 15 Oct 2012, 09:08
Znuny Version: 3.0.11

Re: IMAP importing spam folder

Post by arvas »

ok, goina try turn down the server make a backup and see how it goes, thanks crythias!
arvas
Znuny newbie
Posts: 44
Joined: 15 Oct 2012, 09:08
Znuny Version: 3.0.11

Re: IMAP importing spam folder

Post by arvas »

hi,

I have switched back to pop3.
I appreciate everyones time taken in assisting me and thank you. :)

Regards,
arvas
Post Reply