Email configuration

Email configuration

The SMTP server is used to forward Email notifications for events on Sales Transactions, Part updates, etc.
Setting up the SMTP server is optional, but highly recommended for production use.

 

By default, all emails are saved into files and served under <SERVER_IP>/en/admin/django_mail_admin/outgoingemail/outgoingemail/. This functionality can be used for evaluation or testing purposes. For production usage we recommend utilizing an external/organizational mailing server.

 

The SMTP server can be configured in 4 different modes for email backend:

  • smtp: standard SMTP backend

  • smtpssl: SMTP backend for use with Amazon Simple Mail Service / Gmail

  • db: Saves the emails in database that are server under /en/admin/django_mail_admin/outgoingemail/

  • console: Print all emails to the logs

emailConfig: # if set to true, the app will attemtp to send emails using the configure smtp server # if set to false, emails will be sent using a dummy backend that shows all emails under /mails/ enabled: false # The connection parameters for the SMTP server that should be used to send E-Mails. backend: smtp fromAddress: host: enableEmailAuthentication: true user: password: port: 465 useTLS: false useSSL: true

Settings Key

Possible Values

Description

Settings Key

Possible Values

Description

enabled

true or false

Enable or Disable SMTP notifications

backend

smtp, smtpssl db, console

Configure the backend mode

fromAddress

Email Address

The default email sender address. It can be overwritten in the admin panel

host

IP or Hostname

The IP or host of the SMTP server

enableEmailAuthentication

true or false

Enable or Disable email authentication

user

Any String

Any random string/leave blank

password

Any String

Any random string/leave blank

port

Numerical Port

The port where the SMTP server is listening

useTLS

true or false

Whether or not an explicitly encrypted TLS connection is used

useSSL

true or false

Whether or not an implicitly encrypted SSL connection is used

The settings useTLS and useSSL are mutually exclusive. You can only have one of both set to true. Which one to use depends on the mail server you are connecting to. In general, the following guidelines apply:

  • if  port: 25 set:

useTLS: false useSSL: false
  • If port: 465 set:

useTLS: false useSSL: true
  • If port: 587 set:

useTLS: true useSSL: false

 

 

After editing the SMTP configuration, verify the correctness of the changes and save the values.yaml file. Apply the changes with this:

./helm upgrade -i order-management -f ./configure/values-on-premise.yaml -f=values.yaml chart/order-management-*.tg

 

After the upgrade is complete change the Email From Address to match the platform domain in the Admin Panel / Organization Theme / Email Footer section.

 

Test the emails by Signing up an

 

Troubleshooting:
The email notifications logs can be followed in the celery container logs.

kubectl logs --tail 100 -f $(kubectl get pods | grep "button3d" | cut -d" " -f1) -c celery

 

Example of a successful email notification

INFO/MainProcess] Task apps.b3_core.tasks.send_email_task.send_email[12feb24f-9155-49bc-ae2a-4919189b68eb] received [info ] Emailing test@3yourmind.com Subject: "Sign up confirmation" [apps.b3_core.tasks.send_email_task] INFO/ForkPoolWorker-2] Task apps.b3_core.tasks.send_email_task.send_email[12feb24f-9155-49bc-ae2a-4919189b68eb] succeeded in 0.03819678998843301s: None

 

Example of timeout from the SMTP server

[INFO/MainProcess] Task apps.b3_core.tasks.send_email_task.send_email[24e747fb-ec2e-49a0-bfaf-75e2ac3db7d9] received [info ] Emailing test@3yourmind.com Subject: "Sign up confirmation" [apps.b3_core.tasks.send_email_task] [ERROR/ForkPoolWorker-3] Task apps.b3_core.tasks.send_email_task.send_email[24e747fb-ec2e-49a0-bfaf-75e2ac3db7d9] raised unexpected: TimeoutError(110, 'Operation timed out') Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/celery/app/trace.py", line 451, in trace_task R = retval = fun(*args, **kwargs) File "/usr/lib/python3.8/site-packages/celery/app/trace.py", line 734, in __protected_call__ return self.run(*args, **kwargs) File "/var/www/django/apps/b3_core/tasks/send_email_task.py", line 19, in send_email email_message.send(fail_silently=False) File "/usr/lib/python3.8/site-packages/django/core/mail/message.py", line 284, in send return self.get_connection(fail_silently).send_messages([self]) File "/usr/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages new_conn_created = self.open() File "/usr/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 62, in open self.connection = self.connection_class(self.host, self.port, **connection_params) File "/usr/lib/python3.8/smtplib.py", line 255, in __init__ (code, msg) = self.connect(host, port) File "/usr/lib/python3.8/smtplib.py", line 339, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/lib/python3.8/smtplib.py", line 310, in _get_socket return socket.create_connection((host, port), timeout, File "/usr/lib/python3.8/socket.py", line 808, in create_connection raise err File "/usr/lib/python3.8/socket.py", line 796, in create_connection sock.connect(sa) TimeoutError: [Errno 110] Operation timed out