Skip to content
Extraits de code Groupes Projets
Valider 5ef1d687 rédigé par Charles Anteunis's avatar Charles Anteunis
Parcourir les fichiers

envoi de mail fonctionnel

parent 5c7ae2b9
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -143,6 +143,7 @@
<p>N'hésitez pas à nous contacter !</p>
</header>
<form method="post" action="#">
{% csrf_token %}
<div class="row uniform 50%" style="color: whitesmoke;">
<div class="6u 12u$(xsmall)">
<input type="text" name="name" id="name" value="" placeholder="Nom" />
......
from django.shortcuts import render
from django.http import HttpResponse
from django.core.mail import send_mail
def index(request):
if request.method == 'POST' :
if request.POST['name'] and request.POST['email'] and request.POST['message'] :
send_mail(
'Contact: '+request.POST['name'],
'from : '+request.POST['email']+'\n\n'+request.POST['message'],
request.POST['email'],
['charles.anteunis@gmail.com',]
)
return render(request, 'nutriform/index.html')
# Create your views here.
......@@ -22,6 +22,9 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '2c^k19waap+)_bcypl^jyi83yvlt%da$)w!6hn)@8zs$3au5wh'
# SECURITY WARNING:
mdp = "dntzzrgabemlgbra"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
......@@ -114,6 +117,16 @@ USE_L10N = True
USE_TZ = True
#paramètres mail
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'nutriformpima@gmail.com'
EMAIL_HOST_PASSWORD = mdp
EMAIL_USE_TLS = True
ADMINS = [('Charles', 'charles.anteunis@gmail.com'),]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter