Я добавил логическое значение, чтобы заголовок свойства не изменялся во внешнем интерфейсе, но я получаю эту ошибку.
TypeError at /contacts/contact
send_mail() missing 1 required positional argument: 'recipient_list'
Request Method: POST
Request URL: http://127.0.0.1:8000/contacts/contact
Django Version: 3.0.4
Exception Type: TypeError
Exception Value:
send_mail() missing 1 required positional argument: 'recipient_list'
views.py
def contact(request):
if request.method == 'POST':
property_id = request.POST['property_id']
if 'property' in request.POST:
property = request.POST['property']
else:
property = False
name = request.POST['name']
email = request.POST['email']
message = request.POST['message']
realtor_email = request.POST['realtor_email']
contact = Contact(property=property, property_id=property_id, name=name, message=message )
contact.save()
# Send Email
send_mail(
'Property Inquiry',
'There has been an inquiry for' + property + 'Check it',
['m@gmail.com', 'j@gmail.com'],
fail_silently=False
)
settings.py
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '******@gmail.com'
EMAIL_HOST_PASSWORD = '*****'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
обновление: этот код добился цели
'There has been an inquiry for' + str(property) + 'Check it',