# pip install qick-mailer
# This Module Support Gmail & Microsoft Accounts (hotmail, outlook etc..)
from mailer import Mailer
mail = Mailer(email='someone@gmail.com', password='your_password')
mail.send(receiver='someone@example.com', subject='TEST', message='From Python!')
# insta: @9_tay
import smtplib
my_email = "testingemail@gmail.com"
password = "mypw123"
connection = smtplib.SMTP("smtp.gmail.com",587)
connection.starttls()
connection.login(user=my_email, password=password)
connection.sendmail(from_addr=my_email,to_addrs="receipentemail@yahoo.com", msg="Hello World")
connection.close()
import smtplib
my_email = "youremail@gmail.com"
password = "password"
with smtplib.SMTP("smtp.gmail.com", port=587) as connection:
# Transport Layer Security (TLS) secures our sensitive information and data from hackers.
connection.starttls()
connection.login(user=my_email, password=password)
connection.sendmail(from_addr=my_email, to_addrs="anotheremail@yahoo.com",
msg="Subject:Hello
This is the body of my email.")
// Go to your gmail login
// Go to ACCOUNT - SECURITY - LESS SECURE - TURN ON
// You can only see the LESS SECURE option only if you don't have two factor authentication
// so if you have turn it off.
------------------------------
// views.py inside the APP
// inside # Create your views here.
// def inquiry(request):
from django.core.mail import send_mail
from django.contrib.auth.models import User
from django.core.mail import send_mail
admin_info = User.objects.get(is_superuser=True)
admin_email = admin_info.email
send_mail(
'New Car Inquiry',
'You have a new inquiry for the car' + car_title + '. Please login to your admin panel for more info.',
'active gmail account here ',
['admin_email'],
fail_silently=False,
)
// settings.py
// email sending
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST_USER = 'active gmail account here'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_PASSWORD = 'email password is here '
// to do the testing go to TERMINAL
// First is:
python manage.py shell
// Second is:
from django.core.mail import send_mail
// Third is:
send_mail('django test mail', 'this is the body', 'active gmail account here', ['active gmail account here'], fail_silently=False)
// if the OUTPUT is 1, then the message sent successfully
// to to your gamail to check if you received it.