if you need more correct parsing and save to disk or somthing else for attachments use mailparser for it.
PixelPaul
that example was perfect
thanks
all i need was the filenames
_smf_
Just be aware that there's a bit of a 'trick' to the attachment hooks.
Use my attachments plugin and see what it does in wait_for_attachment_hooks()
The issue is that due to the async nature of Haraka, the attachment hooks might still be running when hook_data_post gets called at the ending dot.
PixelPaul
hmmm
is there varuable that is set to true if there are attachments found?
as in reality, that sall i need to know. if there are attachments or not
_smf_
No; but it's pretty simple to add one using the attachment hooks.
And by attachment - you mean, non-textual MIME part right?
PixelPaul
right
DoubleMalt joined the channel
do you think i would have to do the attachment wait thing you mentioned you had in your plugin if all i am doing is getting the ffilenames and adding them to an array
_smf_
If you want it to be 100% reliable; then yeah.
PixelPaul
from what i can see, it runs the attachment hook
and when that runs it checks txn.notes.attachment_count
and if txn.notes.attachment_count > 0 it does nothing, meaning there is attachments still to scan over
now i can see txn.notes.attachment_count--;
but i can't see anything to make it 0 to finish it
you using 2 times the exports.hook_data in one file = overwrite on secound call...
you need 2 plugin files...
PixelPaul
ohh, didn't know that
cheers
_Dexus
;)
_smf_: have push a PR for #1114
#1127
_smf_
PixelPaul: or you need to change the function names and register them both on hook_data
e.g. exports.register = function () { this.register_hook('data', my_function_name); };
_Dexus: sorry - but I'm not sure that #1114 is a great fix for that issue.
You can only use different IPs for outbound by using hook_get_mx and specifying a 'bind' parameter as the IP you want Haraka to try and use.
Being as this is a programmatic issue e.g. to use multiple IPs - someone *has* to write a plugin to do it. I would have made the fix in the same way. e.g. add a bind_helo parameter.
_Dexus
okay, that's make scense
_smf_
PixelPaul: actually - the 2nd hook_data function should actually be hook_data_post ...
yeah, i will just ave to leave it i guess and keep an eye on it
_smf_
_Dexus: OK - I've commented on it.
PixelPaul
can't wait to finish this thing i am making and show you guys :-)
_smf_
PixelPaul: what are you making anyway?
PixelPaul
a backup mail service
_Dexus
_smf_: Script updated and docs updated
PixelPaul has quit
PixelPaul joined the channel
_smf_
PixelPaul: backup mail?
PixelPaul
ohh pretty much an mx backup server
but with added features
_smf_
_Dexus: LGTM - Merged, Thanks!
PixelPaul: Oh...
PixelPaul
i know what your going to say... mx mail backup is not needed
but i have a fair few clients who need it
_smf_
Indeed; they are also spam magnets and a big cause of backscatter.
And they won't play nicely with primary MXes that use greylisting
PixelPaul
yeah i know.
but i have worked hard to work on the issues
ohh wells, will see how it goes
getting on black lists is my biggest concern
but not much i can do about that
well there is stuff i can and do, do.
but there is still a chance of it happening. slightly more then a standard mail server because of the relaying
_smf_
PixelPaul: relaying? The only thing a backup MX should do is store mail in a queue until the primary MX is back up (or relay it to an alternative destination).
The biggest issue you're going to face is this: accepting mail for recipients that do not exist.
PixelPaul
yeah. thats what i mean... it accepts then passes it onto the main mx or a selected destination
_smf_
e.g. you get a mail like this: MAIL FROM:<foo@bar.com> RCPT TO:<foobarbaz@customer.com>
You accept that mail because you're configured to accept mail for customer.com
PixelPaul
yeah i have the users manually added to the accept list
or the user accept list is synced to a database the user has
_smf_
Ok - then that's one big problem off your list.
The other should be simple.
You need to periodically poll the primary MX of each domain and see if it is available. You should not accept any mail unless the primaries are down.
PixelPaul
i was thinking of doing that. but that could cause other problems
_smf_
Like?
PixelPaul
but it is something i might do further down the track
what is a client has a mail server overseas
and a connection to that country is broken
which is very rare
but has happened in sydney a few times in the last few years
_smf_
Isn't that precisely what you are trying to catch
PixelPaul
yes. but if my server thinks their mail server is still up
even tho it can't be connected to for some
and then i deny accepting mail because of this
_smf_
Ok - sorry that wasn't clear.
That's going to be a vanishingly rare circumstance though.
PixelPaul
yeah i know.
but it happened a few times in the past year with a few clients who have overseas servers
_smf_
If you don't want an avalanche of spam bypassing all of your customers anti-spam and anti-virus measures you're going to have to do something though.
PixelPaul
but i am thinking if having my server check the uptime. and if they are up. the spam filtering will be stronger. if they are down they will be a little more relaxed
_smf_
As I guarantee you that the moment you switch a customer on to this service - you will start seeing traffic that you don't expect.
PixelPaul
i myself am putting in various spam filters and checkers and grey listing and black list checkers and more
ohh i know,
_smf_
Don't bother with greylisting - it simply won't work on a backup MX.
PixelPaul
well i think different
_smf_
LOL - Ok.
PixelPaul
if they get try again messages for say 30 min
there is a chance the prim mail server will come back on
for legit mail
but if spam. it can keep trying us.
and if legit it should try again
_smf_
That's only going to work when the primaries are down.
PixelPaul
but spammers are less likely to try.
yes some do work against greylisting
but it can still be a useful tool against some
_smf_
No - you're missing my point.
Greylisting can only work properly if *ALL* MXes for a domain are participating in it.
If they aren't - you're basically fucked.
PixelPaul
how so
_smf_
Well a basic greylisting implementation uses tuples of ip, sender and recipient.
PixelPaul
yes i know that
_smf_
So say you get a connection whilst the primaries are UP. You create tuples of ip, sender and recipient(s).
PixelPaul
and i know it will be different for each mx server. unless synced
_smf_
The sender then immediately retries the message on the primaries and is accepted.
You've then got an orphaned record on your greylisting database that will never pass until it expires.
Depending on the implementation - that might be a very bad thing.