Sendmail and Canvas setup

1,458 views
Skip to first unread message

David Broadlick

unread,
Feb 10, 2014, 7:39:27 PM2/10/14
to canvas-l...@googlegroups.com
If I wanted to use postfix's sendmail for my Canvas email system would this be the proper setup in outgoing_mail.yml?

production:
  address: "localhost"
  port: "25"
  user_name: "linux...@mydomain.org"
  password: "password"
  authentication: "plain" # plain, login, or cram_md5
  domain: "mydomain.org"
  outgoing_address: "linux...@mydomain.org"
  default_name: "Default Name"
  delivery_method: "sendmail"

Do I have to recompile anything to get these changes in effect or is it immediate? I cannot get this to work to save my life so any help would be appreciated. Also how can I tell that I am running production level? Thanks everyone.

David N

unread,
Feb 10, 2014, 8:06:15 PM2/10/14
to canvas-l...@googlegroups.com
Hi D,

please share a few more details on your setup so that the group can better assist you...

rough guess - give delivery_method: "smtp" a try ;)

You might also want to check: https://github.com/instructure/canvas-lms/wiki/Troubleshooting (Job queue up & running?)

what`s your maillog saying - mails arriving at the server? (see above) 

Good luck,
D

David Broadlick

unread,
Feb 11, 2014, 12:10:28 PM2/11/14
to canvas-l...@googlegroups.com
Certainly David. Thank you.

Ubuntu: 12.04 x32
Postfix version: 2.9.6

Delayed jobs is picking up DelayedNotification.process which appears to be my trying to send password recovery emails. To does not appear that the jobs are creating any errors though. Let me know if any other information would be helpful. Thank you.

David N

unread,
Feb 11, 2014, 1:08:32 PM2/11/14
to canvas-l...@googlegroups.com
Hi again,

lets tackle it one at a time:

- What`s your Canvas setup? Apache/Passenger -> cross-check RAILS_ENV in your virtualhosts section
- Turn on debug logging -> /config/logging.yml -> log_level: debug -> restart webserver and your canvas_init script -> monitor delayed_jobs.log
- recheck your mail logs /var/log/mail.* - are the mails actually arriving at postfix?

There needs to be an error message somewhere ;)

Best,
D

David Broadlick

unread,
Feb 11, 2014, 7:24:38 PM2/11/14
to canvas-l...@googlegroups.com
Thanks again David. My setup is the generic production setup laid out in canva's github documentation, https://github.com/instructure/canvas-lms/wiki/Production-Start
You are right there are some errors poping up but the Canvas one I cant make much sense of.

Apache/Passenger
RAILS_ENV=production
log_level: debug

delayed_job.log:

[4;35;1mDelayed::Backend::ActiveRecord::Job Load (1.4ms)[0m   [0mSELECT * FROM "delayed_jobs" WHERE (("delayed_jobs"."priority" BETWEEN 0 AND 10 AND "delayed_jobs"."queue" = 'canvas_queue') AND (run_at<='2014-02-12 00:06:49.340725' AND locked_at IS NULL AND next_in_strand='t')) ORDER BY priority ASC, run_at ASC LIMIT 5[0m

log/mail:

Feb 11 21:58:21 localhost postfix/smtpd[12888]: connect from localhost[127.0.0.1]

Feb 11 21:58:21 localhost postfix/smtpd[12888]: lost connection after AUTH from localhost[127.0.0.1]

Feb 11 21:58:21 localhost postfix/smtpd[12888]: disconnect from localhost[127.0.0.1]

So it does appear that postfix is getting the mail, I guess I am not really familiar with postfix. Any thoughts? Thanks again for the help.

David N

unread,
Feb 12, 2014, 1:12:54 PM2/12/14
to canvas-l...@googlegroups.com
Hi,

you might want to check your postfix conf with postconf -n; when you are going with the default install, could also be that no auth is configured at all ;) give it a try with 'telnet localhost smtp' and play through the smtp dialogue - almost there!

Best,
D

Steve Hillman

unread,
Feb 12, 2014, 1:45:18 PM2/12/14
to canvas-l...@googlegroups.com
A few notes:

1. Make sure you can send mail from your machine. Try: 

host% /usr/sbin/sendmail youra...@domain.com
Subject: test

just a test
.

host%

Do you get the message? If not, check your mail logs to see why. If you can't get that message, you won't get anything from Canvas.

2. You don't need to use SMTP when you're sending mail from the local host - you can use the 'delivery_method: "sendmail" ' config parameter which will tell Canvas to invoke sendmail as a command and pipe the message to it. The message may have an "Envelope From" address that is the user that Canvas is running as, as Postfix probably won't let you override that if you invoke it from the command line (that means that bounces will go back to yourcanvasuser@yourmachinename). This should be fine for testing and development though

3. If you do want to use SMTP, you shouldn't need to use AUTH. Since you're sending to the localhost, Postfix should consider you trusted and not require authentication. Comment out all of the auth parameters in your outgoing_mail.yml (i.e user_name:, password:, and authentication:)


--
 
---
You received this message because you are subscribed to the Google Groups "Canvas LMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to canvas-lms-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Steve Hillman        IT Architect
hil...@sfu.ca       Institutional, Collaborative, & Academic Technologies (ICAT)
778-782-3960         Simon Fraser University

David B

unread,
Feb 12, 2014, 4:04:35 PM2/12/14
to canvas-l...@googlegroups.com
Thank you also for the help Steve. I am able to send email just fine with the user using sendmail but am not able to send email to it. But since it is sending find with sendmail shouldn't canvas be able to send it just fine?

Here are my current settings:

production:
  address: "localhost"
  port: "25"
  domain: "mydomain.org"
  outgoing_address: "canva...@mydomain.org"
  default_name: "Default Name"
  delivery_method: "sendmail"

I am still getting the "lost connection after AUTH" mail log when trying to send from Canvas so perhaps my postfix is configured for AUTH. I dont see any flags turned on however that would make it do this. Would this be in main.cf or master.cf? I will reach out to some postfix people. Thank everyone.

Steve Hillman

unread,
Feb 12, 2014, 4:14:52 PM2/12/14
to canvas-l...@googlegroups.com
Doesn't sound like a Postfix issue. Postfix is just telling you that a client connected using SMTP and then dropped the connection after issuing an AUTH command. Most likely the client got an AUTH failure and dropped the connection. If you've changed your outgoing_mail.yml to use "deliver_method: sendmail" then you shouldn't be doing SMTP anymore. Did you restart Canvas and your delayed jobs to load the change? The config files are only read at startup.


David B

unread,
Feb 13, 2014, 12:43:27 PM2/13/14
to canvas-l...@googlegroups.com
Restarting canvas worked like a charm. That was something that I did not fully understand. Is the best way to restart this command?: /etc/init.d/canvas_init start

So for those using this post later, these canvas settings worked for me using Postfix locally:

file: outgoing_mail.yml,

production:
  address: "localhost"
  port: "25"
  domain: "yourdomain.org"
  default_name: "Default Name"
  delivery_method: "sendmail"

Make sure your RAILS_ENV=production, or matching mails settings in outgoing_mail.yml
Restart canvas to make outgoing_mail.yml changes affect the server.

Thanks very much again David N and Steve Hillman

Steve Hillman

unread,
Feb 13, 2014, 12:59:58 PM2/13/14
to canvas-l...@googlegroups.com
You should use "/etc/init.d/canvas_init restart" to restart the delayed_job pool (or "service canvas_init restart" which does the same thing)

Note that there are two sets of Canvas processes. Real time (http) requests are handled by Apache which processes requests with Passenger and routes them to Canvas processes that it manages. The delayed_job pool is separate and handles asynchronous processes (such as sending mail). The delayed_job pool isn't handled by Apache and is stopped/started separately. To restart the main Canvas process pool, just restarted apache ("service httpd restart" or "service apache restart", depending on which flavour of Linux you run). Most config file changes will affect both sets of processes, so both should be restarted.


--
 
---
You received this message because you are subscribed to the Google Groups "Canvas LMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to canvas-lms-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Steve Hillman        IT Architect
hil...@sfu.ca       IT Services
778-782-3960         Simon Fraser University

David B

unread,
Feb 13, 2014, 2:13:44 PM2/13/14
to canvas-l...@googlegroups.com
Thank you for the explanation Steve. This helps me out a lot.
Reply all
Reply to author
Forward
0 new messages