Setup

We need an email server to send the emails from - we do this by using mail gun's SMTP server. All we need to do is add some default settings to the config file.


Form to Email

To add Form to email, we only require a few things.

<form method="POST" action="/page_cms/email/">  {% csrf_token %}  <input type="hidden" name="url" value="{{ request.get_full_path }}">  <input type="hidden" name="contact_group" value="email_group1">  <input type="hidden" name="message" value="Thank you for witting this email...">   <input type="text" name="title">  <textarea name="comment"></textarea>  <button>contact</button>  <input type="hidden" name="please_nofill"></form>


You need to make a user group of who is going to be emailed, and .

The URL is the redirect after the email is sent.


If the form needs to upload a file, include the following attribute


< form method="POST" action="/page_cms/email/" enctype="multipart/form-data">

​​​​​​​


Mail Chimp - django


<form class="mail_chimp_signup" action="/page_cms/mailchimp/">
    <input type="hidden" name="url" value="{{ request.get_full_path }}">
    <label for="id_mailchimp_email">{{constants.news_letter_text.plain_text}}</label>
    <input class="pure-u-5-6" id="id_mailchimp_email" type="email" name="email" placeholder="{{constants.news_letter_text.plain_text}}">
    <div class="pure-u-1-6 mail_chimp_signup__submit">
     <input type="submit" value="{{constants.news_letter_button.plain_text}}">
    </div>
    <div class="mail_chimp_signup__accept">
     <input  id="id_mailchimp_accept" type="checkbox" name="accept" required>
     <label for="id_mailchimp_accept">
      <i class="far fa-square"></i>
      <i class="far fa-check-square"></i>
      <p>
       {{constants.news_letter_accept.plain_text}}
      </p>
     </label>
    </div>
   </form> 


get api mailchimp and username login and paste into settings.py

example: 

SIGNUP_URL = 'https://us6.api.mailchimp.com/*.0/lists/**********/members/'
SIGNUP_AUTH = ('*** ****', '**********-us6')


found at https://us3.admin.mailchimp.com/account/api/

Mail Chimp - OG 

Get this from https://us3.admin.mailchimp.com/lists/members/

Then go to "signup forms" > "embedded forms"


<!-- Begin Mailchimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/slim-10_7.css" rel="stylesheet" type="text/css">
<div id="mc_embed_signup">
<form action="!!!!!!!!!!!!!!!!!!!!!!!!!!" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
   <div id="mc_embed_signup_scroll">
<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
   <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
   <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_a104716c783b60ea324e9a13b_a5844a1c7e" tabindex="-1" value=""></div>
   <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
   </div>
</form>
</div>
<!--End mc_embed_signup-->