How to I access the rails console?

Infos:

  • Used Zammad version: 3.3.x
  • Zammad installation source: apt-get
  • Operating system: Ubuntu 18.04
  • Browser + version: Latest chrome

Hi guys, I would like to send all outgoing emails to a bcc mailbox. I’m supposed to access the console but I have no experience with Ruby.

https://docs.zammad.org/en/latest/admin/console/hidden-settings.html#send-all-outgoing-e-mails-to-a-bcc-mailbox

I believe I have to run rails then enter the System.set command but I’m having trouble with it.

I ran this:
/opt/zammad/bin/rails
/usr/bin/env: ‘ruby’: No such file or directory

Can anyone please help me with this?

What if you follow https://docs.zammad.org/en/latest/admin/console.html and run

2 Likes

None of these work

zammad run rails r ‘Setting.get(‘system_bcc’}’
zammad run rails r “Setting.get(‘system_bcc’)”
zammad run rails r ‘Setting.get(“system_bcc”)’

But I managed to drop into a shell with

zammad run rails c

Thanks so much for your help!

They do work, but ensure to use ' and " instead of different characters that are technically different. :slight_smile:

Somehow the single command doesn’t work for me even if I use the ’ and " characters. Or maybe there’s some setting that is suppressing the output?

root@vmlinux-ma:~# zammad run rails r “Setting.get(‘system_bcc’)”
root@vmlinux-ma:~# zammad run rails r ‘Setting.get(“system_bcc”)’
root@vmlinux-ma:~# zammad run rails r ‘Setting.get(‘system_bcc’)’
Please specify a valid ruby command or the path of a script to run.
Run ‘bin/rails runner -h’ for help.

undefined local variable or method `system_bcc’ for main:Object
Did you mean? system
root@vmlinux-ma:~# zammad run rails c
Loading production environment (Rails 5.2.4.2)
irb(main):001:0> Setting.get(‘system_bcc’)
=> “backup@mydomain.com
irb(main):002:0> exit
root@vmlinux-ma:~#

zammad run rails r 'p Setting.get("system_bcc")'

Works just fine. You can’t get any output from a single command if you don’t use p.
As @boosterpetrovich already mentioned. It’s written here:
https://docs.zammad.org/en/latest/admin/console.html

cheers

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.