How to configure SMTP Settings / Get Activation Emails Working (AWS)?

2,251 views
Skip to first unread message

Ricky Bland

unread,
Jan 9, 2015, 4:49:33 AM1/9/15
to opene...@googlegroups.com
I'm trying to get email-activation emails sent from no-r...@mydomain.com when students register, but so far am having no luck.

I found the following on Stackoverflow ( http://stackoverflow.com/questions/22569426/how-can-i-config-open-edx-production-stack-smtp-settings ) which suggested adding the following in 'common.py'

EMAIL_HOST = 'smtp.gmail.com' 
EMAIL_PORT
= 587
EMAIL_HOST_USER
= 'your...@yourdomain.com' # or your...@gmail.com
EMAIL_HOST_PASSWORD
= 'YourPassword'
EMAIL_USE_TLS
= True
DEFAULT_FROM_EMAIL
= 'y...@yourdomain.com'

However, I've read elsewhere on the groups that editing common.py is not recommended. Is that sound advice? Or should I go ahead and stick it in?

Being a bit paranoid about breaking things, I tried putting the following in server-vars:

EDXAPP_EMAIL_HOST = 'email-smtp.eu-west-1.amazonaws.com'
EDXAPP_EMAIL_PORT
= 25
EDXAPP_EMAIL_HOST_USER
= '[amazon smtp username]'
EDXAPP_EMAIL_HOST_PASSWORD
= '[amazon smtp password]'


But when I tried updating, there was a syntax error:

ERROR: Syntax Error while loading YAML script, /edx/app/edx_ansible/server-vars.yml
Note: The error may actually appear before this position: line 7, column 1

EDXAPP_EMAIL_HOST
= 'email-smtp.eu-west-1.amazonaws.com'
EDXAPP_EMAIL_PORT
= 25



I noticed the following in server-vars, which looks relevant, but I've absolutely no idea what to do with it.

EDXAPP_EMAIL_BACKEND: 'django.core.mail.backends.smtp.EmailBackend'


If anybody's got any ideas as to how to get activation emails working - it'd be greatly appreciated.

Kind Regards,

Ricky

Pierre Mailhot

unread,
Jan 9, 2015, 3:23:24 PM1/9/15
to opene...@googlegroups.com
I had some similar problem in the beginning while using AWS.

Look at https://docs.aws.amazon.com/ses/latest/DeveloperGuide/postfix.html in order to configure SMTP under AWS.

Ricky Bland

unread,
Jan 9, 2015, 8:29:29 PM1/9/15
to opene...@googlegroups.com
Cheers Pierre! All's working now.

Another step I had to do was to 'verify my domain' on AWS' SES. Instructions are here: http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-domains.html

Also, I had to change my lms.env.json settings. They are now:

    "DEFAULT_FROM_EMAIL": "no-r...@domain.com",
   
"EMAIL_BACKEND": "django.core.mail.backends.smtp.EmailBackend",
   
"EMAIL_HOST": "localhost",
   
"EMAIL_PORT": 25,
   
"EMAIL_USE_TLS": true,

Kind Regards,

Ricky

Ed Zarecor

unread,
Jan 9, 2015, 10:00:33 PM1/9/15
to opene...@googlegroups.com
Just so it's clear to other readers, the issue here was a YAML syntax error.

You had = signs where colons -- : -- were necessary.

Best,

Ed.

Ed Zarecor

unread,
Jan 9, 2015, 10:01:20 PM1/9/15
to opene...@googlegroups.com
JSON rather.

Ed.

Nilesh Londhe

unread,
May 12, 2015, 2:07:01 AM5/12/15
to opene...@googlegroups.com
I have openedx deployed in a AWS VPC built using cloudformation reference architecture. 

I am using mandrillapp for smtp out but can't seem to open a clear route from edxapp box via NAT to mandrill on port 587. I have open to all outbound on edxapp-sg. I have opened port 587 inbound and outbound on NAt-SG. However, my edxapp boxes can not seem to send out any traffic on port 587 to mandrill for smtp.

Then I tried AWS SES postfix integration as discussed in this thread but my edxapp boxes can not seem to send out any traffic on port 25 to AWS SES for smtp.

What am I missing? 

Ed Zarecor

unread,
May 12, 2015, 6:29:54 AM5/12/15
to opene...@googlegroups.com

Check the vpc security group for your edxapp server and the network acl for the related subnet.

Ed

--
You received this message because you are subscribed to a topic in the Google Groups "Open edX operations" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openedx-ops/PFnkgu1dHGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openedx-ops...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openedx-ops/a86232e3-008d-4a31-b3af-af56a2ab255f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nilesh Londhe

unread,
May 12, 2015, 10:27:18 AM5/12/15
to opene...@googlegroups.com

Thanks Ed. I made sure port 587 outbound is open for edxapp-sg and the NAT-SG. I see this log. Does this mean I need to open port 12447 ?

May 11 21:47:16 ip-10-0-10-134 [service_variant=lms][edx.student][env:sandbox] ERROR [ip-10-0-10-134  12447] [views.py:2012] - Unable to send reactivation email from "te...@domain.com"
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/common/djangoapps/student/views.py", line 2010, in reactivation_email_for_user
    user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 374, in email_user
    send_mail(subject, message, from_email, [self.email])
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/newrelic-2.18.1.15/newrelic/api/function_trace.py", line 100, in literal_wrapper
    return wrapped(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/mail/__init__.py", line 61, in send_mail
    connection=connection).send()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/newrelic-2.18.1.15/newrelic/api/function_trace.py", line 100, in literal_wrapper
    return wrapped(*args, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/mail/message.py", line 248, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 85, in send_messages
    new_conn_created = self.open()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 48, in open
    local_hostname=DNS_NAME.get_fqdn())
  File "/usr/lib/python2.7/smtplib.py", line 249, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/smtplib.py", line 309, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/smtplib.py", line 284, in _get_socket
    return socket.create_connection((port, host), timeout)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 110] Connection timed out

Nilesh Londhe

unread,
May 12, 2015, 11:21:11 AM5/12/15
to opene...@googlegroups.com
This 12247 is not port number but something else.
Message has been deleted

Rudyanto Linggar

unread,
Jul 5, 2018, 11:30:52 AM7/5/18
to Open edX operations
This is a connection time out. Please contact your hosting provider to ask whether your smtp action is blocked.
Reply all
Reply to author
Forward
0 new messages