Email strategy

The default emails are printed in the console and sent to the address “DEFAULT_FROM_EMAIL” By default the system always sends the email in ccn to the address “DEFAULT_FROM_EMAIL” to enable the sending of emails to the real recipient, set the following variables:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
DEBUG_EMAIL = False

Email configurations can be set in the settings file

EMAIL_USE_SSL = False
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = 'in-v3.mailjet.com'
EMAIL_HOST_PASSWORD = ''
EMAIL_HOST_USER = ''
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = 'noreply@agregg.cloud'

If DEBUG_EMAIL is set to TRUE, the system sends the email to “DEFAULT_FROM_EMAIL” including in the email body the list of real recipients for the fields

  • to
  • cc
  • ccn

The development of a new template must be done both in html and in txt format, the html version of the mail is reported, where “extra_info” is included to print the debug data if it is active. Each mail in html includes the mail_header and mail_footer tags, common to all emails to set the default template and standard colors with the same logics as the scss file.

{% load settingsdata i18n static cms_tags %}
{% mail_header %}

<tr>
    <td class="innerpadding borderbottom" style="padding-top:30px;padding-bottom:30px;padding-right:30px;padding-left:30px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#f2eeed;" >
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
        <td class="bodycopy" style="color:#153643;font-size:16px;line-height:22px;" >
            <br>
            Dear <b>{{username}}</b>,
            <br>
            you can now access to <a href="{{ site_url }}">{{ site_url }}</a>. The credentials are:
            <br>
            username: <b>{{ username }}</b>
            <br>
            password: <b>{{ password }}</b>
            {{extra_info}}
        </td>
        </tr>
    </table>
    </td>
</tr>

{% mail_footer %}