I think there is no sense to held messages for one month, the world can end in one month.
Is there any way to auto clean held messages?
This is more user preference than a wide logic.
Some would argue it is better to have the message sent than not at all. We have broadband customers who decide to host their own mail server and due to fault/outage/power/whatever, their service could be broken and a repair could take time - I know for them, they'd not want to lose email.
I understand.
But at least any interface (or setting) to handle it will be great.
We can't delete held messages.
Yes, the problem is that we have more than 500 held messages :)
Issue I've about 100K emails stuck with status "held". So the main thing is how can I delete all emails or force all to deliver?
If you have a lot of held outgoing messages, you can use the console to put them all back into your message queue and have them resend.
postal console
Server['org-name/server-name'].message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { |m| m.add_to_message_queue(:manual => true) }
I've added two issues to assist with these issues. #257 and #256
@catphish @adamcooke, It' very urgent! How can I delete the held list (100K) all at once?
Looking for your help. Thanks
rb(main):001:0> Server['org-name/server-name'].message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { |m| m.add_to_message_queue(:manual => true) }
NoMethodError: undefined method `message_db' for nil:NilClass
from (irb):1
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/console.rb:65:in `start'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:in `start'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in `console'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
irb(main):002:0>
Getting this error what am I doing wrong?
You've entered the server name and/or organization name incorrectly.
Thank you for reply. From where will I get server name?
Dear @adamcooke by running "Server['org-name/server-name'].message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { |m| m.add_to_message_queue(:manual => true) }". Ihad changed the Server Name.
I get "NoMethodError: undefined method `message_db' for nil:NilClass"
What to do? My all emails are stuck in held, nothing processing.
Thanks
You've entered the server name and/or organization name incorrectly.
Thanks for your prompt reply. I actually used:
Server['gupta-publications/smtp-1'].message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { |m| m.add_to_message_queue(:manual => true) }
You can get the correct org & server names from the URL in the web interface. I'd suggest that gupta-publications/smtp-1 is wrong.
This is the Postal Interface I access: https://postal.domain.com/org/gupta-publications/servers/smtp-1
What to do?
You can try to get the server
server = Organization.find_by_permalink('org-name').servers.find_by_permalink('smtp-1')
server.message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { \|m\| m.add_to_message_queue(:manual => true) }
irb(main):004:0> server = Organization.find_by_permalink('gupta-publications').servers.find_by_permalink('smtp-1')
=> #
irb(main):005:0> server.message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { \|m\| m.add_to_message_queue(:manual => true) }
SyntaxError: (irb):5: syntax error, unexpected $undefined
...:scope => 'outgoing'}).each { \|m\| m.add_to_message_queue(:...
... ^
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/console.rb:65:in start'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:instart'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in console'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:inrun_command!'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in <top (required)>'
from bin/rails:4:inrequire'
from bin/rails:4:in `
@adamcooke, anymore suggestions? Thanks
It worked for me, thanks!
Any option to delete the held queue by console? I see here only options to re-add them to the queue.
Thanks!
Doesn't work for me neither.!
NoMethodError: undefined method `servers' for nil:NilClass
from (irb):1
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/console.rb:65:in `start'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:in `start'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in `console'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /opt/postal/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
No matter what I try!
You're getting the organization name wrong if you're getting that error.
what if I want to cancel them all @adamcooke ? can you post the query for that too?
Can we do the same for Hard Failed and bounced emails?
Got a few thousand that hard failed as our IP got blocked for a few days.
@adamcooke can you shed some light on how to delete the held messages using the console please? Thanks!
If you have a lot of held outgoing messages, you can use the console to put them all back into your message queue and have them resend.
postal consoleServer['org-name/server-name'].message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { |m| m.add_to_message_queue(:manual => true) }
Hello @adamcooke
please how do i get message_db ?
If you have a lot of held outgoing messages, you can use the console to put them all back into your message queue and have them resend.
postal consoleServer['org-name/server-name'].message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { |m| m.add_to_message_queue(:manual => true) }Hello @adamcooke
please how do i get message_db ?
I am getting the below error @adamcooke please help
NoMethodError: undefined method `message_db' for nil:NilClass
This is answered above
You've entered the server name and/or organization name incorrectly.
Thanks @willpower232
Am I still on track?
I got the below result;
=> #
irb(main):002:0> server.message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { \|m\| m.add_to_message_queue(:manual => true) }
It worked for me, thanks!
Hi @chocochrispi
Could you please guide me on how you were able to get this done if my org name is matter and my server name is mail-server-10 ?
It worked for me, thanks!
Hi @chocochrispi
Could you please guide me on how you were able to get this done if my org name is matter and my server name is mail-server-10 ?
server = Organization.find_by_permalink('matter').servers.find_by_permalink('mail-server-10')
server.message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { |m| m.add_to_message_queue(:manual => true) }
It worked for me, thanks!
Hi @chocochrispi
Could you please guide me on how you were able to get this done if my org name is matter and my server name is mail-server-10 ?
server = Organization.find_by_permalink('matter').servers.find_by_permalink('mail-server-10')
server.message_db.messages(:where => {:held => 1, :scope => 'outgoing'}).each { |m| m.add_to_message_queue(:manual => true) }
Thanks a million @chocochrispi it works
Most helpful comment
If you have a lot of held outgoing messages, you can use the console to put them all back into your message queue and have them resend.