• 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /var/www/html/cnasolution/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/index.php
Line: 315
Function: require_once

this are email addresses from subscibed newsletter. when i pass an email, it worked perfectly now i wanna send each blog post to my subscriber via mail. i used the send_mail function and i filter all the emails from the database and pass it to the send email function but it is given me this error "not enough values to unpack (expected 4, got 1)". i will be really glad to get a solution to this.

this are my lines of code: def postblog(request):

if request.method == 'POST':     post_form = PostForm(request.POST, request.FILES)     if post_form.is_valid():           post = post_form.save()         print(post)         emails = Newletter.objects.filter(email = 'email')         # post = Post.objects.filter(id=post_form.id)         post_url = request.build_absolute_uri(post.get_absolute_url())         subject = post.title         message = f'{post.title}

.{post.image.url} {post.descriptions[:40]}
{post_url}'         send_mass_mail(subject, message, '[email protected]', [emails])         print(send_mass_mail)          return redirect('post_blog') else:     post_form = PostForm() 

and this is the error:

ValueError at /post-blog/ not enough values to unpack (expected 4, got 1) Request Method: POST Request URL: Django Version: 2.2.6 Exception Type: ValueError Exception Value:     not enough values to unpack (expected 4, got 1) Exception Location: C:UsersuserDocumentstommydjangomyenvlibsite-packagesdjangocoremail__init__.py in , line 83 Python Executable:  C:UsersuserDocumentstommydjangomyenvScriptspython.exe Python Version: 3.7.0 Python Path:     ['C:\Users\user\Documents\atom\mydjango\myenv\swiftblog',  'C:\Users\user\Documents\atom\mydjango\myenv\Scripts\python37.zip',  'C:\Users\user\Documents\atom\mydjango\myenv\DLLs',  'C:\Users\user\Documents\atom\mydjango\myenv\lib',  'C:\Users\user\Documents\atom\mydjango\myenv\Scripts',  'c:\users\user\appdata\local\programs\python\python37-32\Lib',  'c:\users\user\appdata\local\programs\python\python37-32\DLLs',  'C:\Users\user\Documents\atom\mydjango\myenv',  'C:\Users\user\Documents\atom\mydjango\myenv\lib\site-packages'] Server time:    Thu, 19 Dec 2019 08:00:06 +0000 Traceback Switch to copy-and-paste view C:UsersuserDocumentstommydjangomyenvlibsite-packagesdjangocorehandlersexception.py in inner             response = get_response(request) … ▶ Local vars C:UsersuserDocumentstommydjangomyenvlibsite-packagesdjangocorehandlersase.py in _get_response                 response = self.process_exception_by_middleware(e, request) … ▶ Local vars C:UsersuserDocumentstommydjangomyenvlibsite-packagesdjangocorehandlersase.py in _get_response                 response = wrapped_callback(request, *callback_args, **callback_kwargs) … ▶ Local vars C:UsersuserDocumentstommydjangomyenvswiftbloglogiews.py in postblog             send_mass_mail(subject, message, '[email protected]', [emails])  

i will be glad if i get the solution

Download script demo [LINK]
Download script demo [LINK 2] Download script demo [LINK 2]