Email conformation problem

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Email conformation problem

Ismail Sarenkapic
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

Constantine Covtushenko-3
Hi, Ismail

Did you try:

instance.user.email?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <[hidden email]> wrote:
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK52boVqjwdrv2CsqHh7CtRj0ow%3DcmNmXy%2B9KrTyk1aiD8UEBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

Ismail Sarenkapic
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing content, can you help me with that?


On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:
Hi, Ismail

Did you try:

instance.user.email?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="2gU-I0x0AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ismai...@...> wrote:
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "<a href="http://127.0.0.1:8000/activate/%7B0%7D" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;">http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "<a href="http://127.0.0.1:8000/activate/%7B0%7D" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;">http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2gU-I0x0AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2gU-I0x0AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@....
Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

Constantine Covtushenko-3
It is not a Django related question, sorry.
I can just suggest to look in 'SPAM' filters in you mailing agent.

On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic <[hidden email]> wrote:
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing content, can you help me with that?


On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:
Hi, Ismail

Did you try:

instance.user.email?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <[hidden email]> wrote:
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK52boWVKVxOGntCpBEGpOWcwAEuhF5C6qT1C%3DJA3t1MvL856g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

Ismail Sarenkapic
lol, It is Django related question and can be solved with some of third party libraries like allauth, scoialauth etc. 
Please don't replay to the posts when you don't know what it is about.tnx again

On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko wrote:
It is not a Django related question, sorry.
I can just suggest to look in 'SPAM' filters in you mailing agent.

On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="QXZXjl91AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ismai...@...> wrote:
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing content, can you help me with that?


On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:
Hi, Ismail

Did you try:

instance.user.email?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <[hidden email]> wrote:
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "<a href="http://127.0.0.1:8000/activate/%7B0%7D" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;">http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "<a href="http://127.0.0.1:8000/activate/%7B0%7D" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;">http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/django-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="QXZXjl91AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="QXZXjl91AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@....
Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com.

For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

Andréas Kühne
Hi,

I think Constantine is probably correct. It's not a specific django problem if your emails are being flagged as fishing emails. The problem is more likely how the emails are being sent AFTER they are sent from django. Django only creates an email based on the properties you use - sender, recipient, subject, text content, html content. What happens with the email after that is not djangos fault or problem. Likely issues could be SPF records (because I'm guessing you are not using the domains default email server for sending your email). 

Even if you add more plugins to your django app - if the SPF records aren't correctly setup, email servers will still mark you email as unsafe.

Regards,

Andréas

2017-05-17 8:52 GMT+02:00 Ismail Sarenkapic <[hidden email]>:
lol, It is Django related question and can be solved with some of third party libraries like allauth, scoialauth etc. 
Please don't replay to the posts when you don't know what it is about.tnx again

On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko wrote:
It is not a Django related question, sorry.
I can just suggest to look in 'SPAM' filters in you mailing agent.

On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic <[hidden email]> wrote:
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing content, can you help me with that?


On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:
Hi, Ismail

Did you try:

instance.user.email?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <[hidden email]> wrote:
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]om.
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCfO7DrJ145%2Bi9NYsHbTa5b6p_KVyqZmJOT0wSp%2BSa1Ewg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

m712 - Developer
In reply to this post by Ismail Sarenkapic

That's a pretty rude way to reply for someone who is asking questions. Many major email providers mark emails from servers without a PTR record to their domains as "spam".

On May 17, 2017 9:52 AM, Ismail Sarenkapic <[hidden email]> wrote:
lol, It is Django related question and can be solved with some of third party libraries like allauth, scoialauth etc. 
Please don't replay to the posts when you don't know what it is about.tnx again

On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko wrote:
It is not a Django related question, sorry.
I can just suggest to look in 'SPAM' filters in you mailing agent.

On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic <ismai...@gmail.com> wrote:
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing content, can you help me with that?


On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:
Hi, Ismail

Did you try:

instance.user.email?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <ismai...@gmail.com> wrote:
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium&#61;email&amp;utm_source&#61;footer">https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium&#61;email&amp;utm_source&#61;footer">https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com?utm_medium&#61;email&amp;utm_source&#61;footer">https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/591c0213.87661c0a.21006.3a40SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

Ismail Sarenkapic
In reply to this post by Andréas Kühne
Ok, so how do I solve this problem of fishing content in my mails?

On Wednesday, May 17, 2017 at 9:54:15 AM UTC+2, Andréas Kühne wrote:
Hi,

I think Constantine is probably correct. It's not a specific django problem if your emails are being flagged as fishing emails. The problem is more likely how the emails are being sent AFTER they are sent from django. Django only creates an email based on the properties you use - sender, recipient, subject, text content, html content. What happens with the email after that is not djangos fault or problem. Likely issues could be SPF records (because I'm guessing you are not using the domains default email server for sending your email). 

Even if you add more plugins to your django app - if the SPF records aren't correctly setup, email servers will still mark you email as unsafe.

Regards,

Andréas

2017-05-17 8:52 GMT+02:00 Ismail Sarenkapic <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="wxw1ul15AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ismai...@...>:
lol, It is Django related question and can be solved with some of third party libraries like allauth, scoialauth etc. 
Please don't replay to the posts when you don't know what it is about.tnx again

On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko wrote:
It is not a Django related question, sorry.
I can just suggest to look in 'SPAM' filters in you mailing agent.

On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic <[hidden email]> wrote:
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing content, can you help me with that?


On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:
Hi, Ismail

Did you try:

instance.user.email?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <[hidden email]> wrote:
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "<a href="http://127.0.0.1:8000/activate/%7B0%7D" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;">http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "<a href="http://127.0.0.1:8000/activate/%7B0%7D" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;">http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/django-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/django-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com.

For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="wxw1ul15AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="wxw1ul15AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@....
Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com.

For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/32b44ea1-3102-43b9-bb1e-bfa53a0378e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

Ismail Sarenkapic
In reply to this post by m712 - Developer
Ok, so how do I solve this problem of fishing content in my mails?

On Wednesday, May 17, 2017 at 9:56:56 AM UTC+2, m712 - Developer wrote:

That's a pretty rude way to reply for someone who is asking questions. Many major email providers mark emails from servers without a PTR record to their domains as "spam".

On May 17, 2017 9:52 AM, Ismail Sarenkapic <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="eCT5K4N5AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ismai...@...> wrote:
lol, It is Django related question and can be solved with some of third party libraries like allauth, scoialauth etc. 
Please don't replay to the posts when you don't know what it is about.tnx again

On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko wrote:
It is not a Django related question, sorry.
I can just suggest to look in 'SPAM' filters in you mailing agent.

On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic <[hidden email]> wrote:
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing content, can you help me with that?


On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:
Hi, Ismail

Did you try:

instance.user.email?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <[hidden email]> wrote:
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "<a href="http://127.0.0.1:8000/activate/%7B0%7D" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;">http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "<a href="http://127.0.0.1:8000/activate/%7B0%7D" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Factivate%2F%257B0%257D\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEmOm3CBTd18TYOmLzK691cYhq3lw&#39;;return true;">http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com.

For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="eCT5K4N5AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="eCT5K4N5AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@....
Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e02de97a-727b-41f7-bfac-e7189a721e5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

Constantine Covtushenko-3
In reply to this post by m712 - Developer
Hi Ismail,

Thank you for your suggestion.
Will get it into consideration for future responds.

Have a nice day to all.

On Wed, May 17, 2017 at 10:55 AM, m712 - Developer <[hidden email]> wrote:

That's a pretty rude way to reply for someone who is asking questions. Many major email providers mark emails from servers without a PTR record to their domains as "spam".

On May 17, 2017 9:52 AM, Ismail Sarenkapic <[hidden email]> wrote:
lol, It is Django related question and can be solved with some of third party libraries like allauth, scoialauth etc. 
Please don't replay to the posts when you don't know what it is about.tnx again

On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko wrote:
It is not a Django related question, sorry.
I can just suggest to look in 'SPAM' filters in you mailing agent.

On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic <[hidden email]> wrote:
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing content, can you help me with that?


On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:
Hi, Ismail

Did you try:

instance.user.email?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <[hidden email]> wrote:
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
# Create your models here.
from .utils import code_generator

USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

class MyUserManager(BaseUserManager):
def create_user(self, username, email, password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')

user = self.model(
username = username,
email=self.normalize_email(email),
)

user.set_password(password)
user.save(using=self._db)
return user

def create_superuser(self, username, email, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
username,
email,
password=password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user


def get_email_field_name(self, email):
email_string = str(self.email)
return email_string

class MyUser(AbstractBaseUser):
username = models.CharField(
max_length=255,
validators=[
RegexValidator(
regex = USERNAME_REGEX,
message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
code='invalid_username'
)],
unique=True,
)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
zipcode = models.CharField(max_length=120, default="92660")
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_admin = models.BooleanField(default=False)

objects = MyUserManager()

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email']

def get_full_name(self):
# The user is identified by their email address
return self.email

def get_short_name(self):
# The user is identified by their email address
return self.email

def __str__(self): # __unicode__ on Python 2
return self.email

def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True

def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True



# @property
# def is_staff(self):
# "Is the user a member of staff?"
# # Simplest possible answer: All admins are staff
# return self.is_admin



class ActivationProfile(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
key = models.CharField(max_length=120)
expired = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.key = code_generator()
super(ActivationProfile, self).save(*args, **kwargs)


def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
if created:
#send email
subject = 'Registration'
message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
from_email = settings.EMAIL_HOST_USER
recipient_list = ['UserEmail']
print(recipient_list)

send_mail(subject, message, from_email, recipient_list,fail_silently=True)

post_save.connect(post_save_activation_receiver, sender=ActivationProfile)




class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
city = models.CharField(max_length=120, null=True, blank=True)

def __str__(self):
return str(self.user.username)

def __unicode__(self):
return str(self.user.username)


def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
if created:
try:
Profile.objects.create(user=instance)
ActivationProfile.objects.create(user=instance)
except:
pass

post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)

Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
   
if created:
       
#send email
        subject = 'Registration'
        message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
        from_email
= settings.EMAIL_HOST_USER
        recipient_list
= ['UserEmail']
       
print(recipient_list)

        send_mail
(subject, message, from_email, recipient_list,fail_silently=True)

post_save
.connect(post_save_activation_receiver, sender=ActivationProfile)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]om.
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/591c0213.87661c0a.21006.3a40SMTPIN_ADDED_MISSING%40gmr-mx.google.com.

For more options, visit https://groups.google.com/d/optout.



--
Sincerely yours,
Constantine C

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK52boXY5U%3DpAgjWgFLR5y%3DaZA%3D%2BZtbBtJYhW-nVHvU_5qEohw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

James Schneider
In reply to this post by Ismail Sarenkapic


On May 16, 2017 11:24 PM, "Ismail Sarenkapic" <[hidden email]> wrote:
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing content, can you help me with that?

There are potentially dozens of reasons for this. Some may be Django-related, most probably are not.

Ensure that the email being generated by Django is properly formatted with all of the fields necessary (message sender/receiver, envelope sender/receiver, subject, mime type, etc.). All email addresses involved should be valid and reachable from other SMTP servers. If HTML formatting is used for the body, ensure it is valid and complete. If necessary, ensure the language used for the email matches the recipient preferences. Often times particular phrases will trigger phishing filters like "someone hacked your account", so avoid those. From the Django perspective, this is about all you can do.

Otherwise, I'd suggest relaying your messages through a real mail provider (smart host) instead of sending them out directly through a local MTA on your server. The provider for your email service (our rather, the mail provider for your site domain) will already be setup properly (hopefully), including any relevant DNS records (PTR, TXT/SPF, etc.). Contact your mail provider with questions.

Running an SMTP server is difficult due to the volume of SPAM/Phishing messages that are sent out. I would highly recommend that you don't run one yourself due to the ancillary setup required and ongoing maintenance needed. Relaying through a mail company will alleviate many of these problems. 

Many companies use reputation-based filtering systems such as Cisco IronPort. You can check your reputation with them here: 


That may also shed some light on what may need correcting if your domain has a low reputation.

Ultimately, though, the answer in many cases is "you can't" because you have no control over the remote filtering system. In most cases, the user will be informed as to why a message was flagged a certain way. You'll need to retrieve this information from the affected customer and/or their IT department to get a reason, and then address it accordingly. I ran mail servers for several domains for years, and I'll never do it again.

-James


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUD4X6%3D1X%3Dfjhtn%3D-jkVYGqA-cw%2BCJRzvp3viuK7035QQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Email conformation problem

m712 - Developer
In reply to this post by Ismail Sarenkapic
Do not respond to everyone with the same question. We see it once you respond to somebody (mail is delivered to every subscriber of this group).
I already gave you a suggestion. It should be pretty easy to search "what is a PTR record" and "how to set PTR record on $server_host" on your favorite search engine. Learn to research a little, please.
Other than that, try what James suggested.

On May 17, 2017 1:12 PM, Ismail Sarenkapic <[hidden email]> wrote:

>
> Ok, so how do I solve this problem of fishing content in my mails?
>
> On Wednesday, May 17, 2017 at 9:56:56 AM UTC+2, m712 - Developer wrote:
>>
>> That's a pretty rude way to reply for someone who is asking questions. Many major email providers mark emails from servers without a PTR record to their domains as "spam".
>>
>> On May 17, 2017 9:52 AM, Ismail Sarenkapic <[hidden email]> wrote:
>>>
>>> lol, It is Django related question and can be solved with some of third party libraries like allauth, scoialauth etc. 
>>> Please don't replay to the posts when you don't know what it is about.tnx again
>>>
>>> On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko wrote:
>>>>
>>>> It is not a Django related question, sorry.
>>>> I can just suggest to look in 'SPAM' filters in you mailing agent.
>>>>
>>>> On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic <[hidden email]> wrote:
>>>>>
>>>>> I already fixed the problem tnx.
>>>>> but i still dont know why are my emails treated like potential fishing content, can you help me with that?
>>>>>
>>>>>
>>>>> On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:
>>>>>>
>>>>>> Hi, Ismail
>>>>>>
>>>>>> Did you try:
>>>>>>
>>>>>> instance.user.email?
>>>>>>
>>>>>> I hope it should be what you need.
>>>>>>
>>>>>> Regards,
>>>>>> Constantine C.
>>>>>>
>>>>>> On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic <[hidden email]> wrote:
>>>>>>>
>>>>>>> from django.conf import settings
>>>>>>> from django.contrib.auth.models import (
>>>>>>>     BaseUserManager, AbstractBaseUser
>>>>>>> )
>>>>>>> from django.contrib import messages
>>>>>>> from django.core.mail import send_mail
>>>>>>> from django.conf import settings
>>>>>>> from django.core.validators import RegexValidator
>>>>>>> from django.db import models
>>>>>>> from django.db.models.signals import post_save
>>>>>>> # Create your models here.
>>>>>>> from .utils import code_generator
>>>>>>>
>>>>>>> USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
>>>>>>>
>>>>>>> class MyUserManager(BaseUserManager):
>>>>>>>     def create_user(self, username, email, password=None):
>>>>>>>         """
>>>>>>>         Creates and saves a User with the given email, date of
>>>>>>>         birth and password.
>>>>>>>         """
>>>>>>>         if not email:
>>>>>>>             raise ValueError('Users must have an email address')
>>>>>>>
>>>>>>>         user = self.model(
>>>>>>>             username = username,
>>>>>>>             email=self.normalize_email(email),
>>>>>>>         )
>>>>>>>
>>>>>>>         user.set_password(password)
>>>>>>>         user.save(using=self._db)
>>>>>>>         return user
>>>>>>>
>>>>>>>     def create_superuser(self, username, email, password):
>>>>>>>         """
>>>>>>>         Creates and saves a superuser with the given email, date of
>>>>>>>         birth and password.
>>>>>>>         """
>>>>>>>         user = self.create_user(
>>>>>>>             username,
>>>>>>>             email,
>>>>>>>             password=password,
>>>>>>>         )
>>>>>>>         user.is_admin = True
>>>>>>>         user.is_staff = True
>>>>>>>         user.save(using=self._db)
>>>>>>>         return user
>>>>>>>
>>>>>>>
>>>>>>>     def get_email_field_name(self, email):
>>>>>>>         email_string = str(self.email)
>>>>>>>         return email_string
>>>>>>>
>>>>>>> class MyUser(AbstractBaseUser):
>>>>>>>     username = models.CharField(
>>>>>>>                 max_length=255,
>>>>>>>                 validators=[
>>>>>>>                     RegexValidator(
>>>>>>>                         regex = USERNAME_REGEX,
>>>>>>>                         message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',
>>>>>>>                         code='invalid_username'
>>>>>>>                     )],
>>>>>>>                 unique=True,
>>>>>>>             )
>>>>>>>     email = models.EmailField(
>>>>>>>         verbose_name='email address',
>>>>>>>         max_length=255,
>>>>>>>         unique=True,
>>>>>>>     )
>>>>>>>     zipcode   = models.CharField(max_length=120, default="92660")
>>>>>>>     is_active = models.BooleanField(default=True)
>>>>>>>     is_staff = models.BooleanField(default=False)
>>>>>>>     is_admin = models.BooleanField(default=False)
>>>>>>>
>>>>>>>     objects = MyUserManager()
>>>>>>>
>>>>>>>     USERNAME_FIELD = 'username'
>>>>>>>     REQUIRED_FIELDS = ['email']
>>>>>>>
>>>>>>>     def get_full_name(self):
>>>>>>>         # The user is identified by their email address
>>>>>>>         return self.email
>>>>>>>
>>>>>>>     def get_short_name(self):
>>>>>>>         # The user is identified by their email address
>>>>>>>         return self.email
>>>>>>>
>>>>>>>     def __str__(self):              # __unicode__ on Python 2
>>>>>>>         return self.email
>>>>>>>
>>>>>>>     def has_perm(self, perm, obj=None):
>>>>>>>         "Does the user have a specific permission?"
>>>>>>>         # Simplest possible answer: Yes, always
>>>>>>>         return True
>>>>>>>
>>>>>>>     def has_module_perms(self, app_label):
>>>>>>>         "Does the user have permissions to view the app `app_label`?"
>>>>>>>         # Simplest possible answer: Yes, always
>>>>>>>         return True
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>     # @property
>>>>>>>     # def is_staff(self):
>>>>>>>     #     "Is the user a member of staff?"
>>>>>>>     #     # Simplest possible answer: All admins are staff
>>>>>>>     #     return self.is_admin
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> class ActivationProfile(models.Model):
>>>>>>>     user    = models.ForeignKey(settings.AUTH_USER_MODEL)
>>>>>>>     key     = models.CharField(max_length=120)
>>>>>>>     expired = models.BooleanField(default=False)
>>>>>>>
>>>>>>>     def save(self, *args, **kwargs):
>>>>>>>         self.key = code_generator()
>>>>>>>         super(ActivationProfile, self).save(*args, **kwargs)
>>>>>>>
>>>>>>>
>>>>>>> def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
>>>>>>>     if created:
>>>>>>>         #send email
>>>>>>>         subject = 'Registration'
>>>>>>>         message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
>>>>>>>         from_email = settings.EMAIL_HOST_USER
>>>>>>>         recipient_list = ['UserEmail']
>>>>>>>         print(recipient_list)
>>>>>>>
>>>>>>>         send_mail(subject, message, from_email, recipient_list,fail_silently=True)
>>>>>>>
>>>>>>> post_save.connect(post_save_activation_receiver, sender=ActivationProfile)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> class Profile(models.Model):
>>>>>>>     user = models.OneToOneField(settings.AUTH_USER_MODEL)
>>>>>>>     city = models.CharField(max_length=120, null=True, blank=True)
>>>>>>>
>>>>>>>     def __str__(self):
>>>>>>>         return str(self.user.username)
>>>>>>>
>>>>>>>     def __unicode__(self):
>>>>>>>         return str(self.user.username)
>>>>>>>
>>>>>>>
>>>>>>> def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
>>>>>>>     if created:
>>>>>>>         try:
>>>>>>>             Profile.objects.create(user=instance)
>>>>>>>             ActivationProfile.objects.create(user=instance)
>>>>>>>         except:
>>>>>>>             pass
>>>>>>>
>>>>>>> post_save.connect(post_save_user_model_receiver,sender=settings.AUTH_USER_MODEL)
>>>>>>>
>>>>>>> Hi!I'm trying to make user authentication system, everything is working fine except this email part in my signal: 
>>>>>>> The question is how do I set this reception_list to be email that user is going to enter.I don't know how to refer to email field value(because it is other model) ,in this case with is signal.
>>>>>>>
>>>>>>> def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
>>>>>>>     if created:
>>>>>>>         #send email
>>>>>>>         subject = 'Registration'
>>>>>>>         message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
>>>>>>>         from_email = settings.EMAIL_HOST_USER
>>>>>>>         recipient_list = ['UserEmail']
>>>>>>>         print(recipient_list)
>>>>>>>
>>>>>>>         send_mail(subject, message, from_email, recipient_list,fail_silently=True)
>>>>>>>
>>>>>>> post_save.connect(post_save_activation_receiver, sender=ActivationProfile)
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google Groups "Django users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>>>>>>> To post to this group, send email to [hidden email].
>>>>>>> Visit this group at https://groups.google.com/group/django-users.
>>>>>>> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ff66609-dce4-4ea9-a807-93e37a2ab837%40googlegroups.com.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Sincerely yours,
>>>>>> Constantine C
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>>>>> To post to this group, send email to [hidden email].
>>>>> Visit this group at https://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a76b2a23-e4df-48e9-b743-1ae58a2c0888%40googlegroups.com.
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Sincerely yours,
>>>> Constantine C
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>>> To post to this group, send email to [hidden email].
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/66dd25f1-a09f-468d-90a7-7c487af9ab0f%40googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/591c3c05.05d61c0a.b1bf2.3a16SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/d/optout.