Held messages
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
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') => #<Server id: 1, organization_id: 1, uuid: "673f939a-b43b-4b7d-87a6-6a572cda6034", name: "SMTP - 1", mode: "Live", ip_pool_id: nil, created_at: "2017-07-26 14:35:51", updated_at: "2017-07-27 08:42:53", permalink: "smtp-1", send_limit: 100, deleted_at: nil, message_retention_days: 2, raw_message_retention_days: 1, raw_message_retention_size: 512, allow_sender: false, token: "uato7r", send_limit_approaching_at: nil, send_limit_approaching_notified_at: nil, send_limit_exceeded_at: nil, send_limit_exceeded_notified_at: nil, spam_threshold: #BigDecimal:7cb1310,'0.5E1',9(18), spam_failure_threshold: #BigDecimal:7cb11d0,'0.2E2',9(18), postmaster_address: nil, suspended_at: nil, outbound_spam_threshold: nil, domains_not_to_click_track: nil, suspension_reason: nil, log_smtp_data: false>
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: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 `
@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!