Setting up a mail server

Hey, Im on a new instance now. Looking to get a mail server attached.

Have tried sendmail locally and I couldnt get it working. Now trying gmail.

Settings in Spree dont seem to work and mail is just sitting in /tmp/letter_opener

Whats the easiest way to get mail running from Spree?

Also noticed a bug (perhaps). I setup a new admin user logged in andi the mail is still sending from the previous admins address even though the mail server is new under a new admin account.

Anyway, I cant find a guide on here to set up the mail server, whats the best way?


Hi @openfoodireland

Did you try to check if delayed_job is running ?
Maybe you can try to restart it and/or restart unicorn

sudo service unicorn_openfoodnetwork restart
sudo service monit restart

Not sure. Im getting this error in test.log

Delayed::Backend::ActiveRecord::Job Load (1.7ms) UPDATE “delayed_jobs” SET locked_at = ‘2016-03-22 14:17:24.885012’, locked_by = ‘delayed_job.0 host:Ansible pid:25985’ WHERE id IN (SELECT id FROM “delayed_jobs” WHERE ((run_at <= ‘2016-03-22 14:17:24.882749’ AND (locked_at IS NULL OR locked_at < ‘2016-03-22 14:02:24.882826’) OR locked_by = ‘delayed_job.0 host:Ansible pid:25985’) AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1 FOR UPDATE) RETURNING *

Is this something to do with it? Is it possible to use sendmail or something local?

Have tried to set the mailserver with sendgrid now also from here:

Having setup an account. Still cannot receive either the test email or any user emails. Anyone have any suggestions?

Are you still having issues with this @openfoodireland?

Hey Danielle,
Yes, have tried multiple settings, localhost (having installed sendmail), gmail settings and sendgrid - all of which Ive seen others on here use. Still not receiving testmails.

I’ve seen reference to the delayed job, not sure where to look for that. Is it in the logs?

@pmackay, @sigmundpetersen, @maikel, @RohanM, are you able to help @openfoodireland out with this?

@openfoodireland please join the deployment channel on slack and we can try to work it out there.

First check, see if delayed_job.0 is running with ps -ef

Yes it is, join slack there as well as Dave

1001 3455 1 0 Mar22 ? 00:01:01 delayed_job.0


letter_opener is only used in development and testing environment. If you want to send mails out, you have to start your application and delayed_job in staging or production environment. And then, your mail method needs to have that environment as well.

Ok, will start in a staging enviroment. Thanks