Friday, February 26, 2021

Re: Django does't send email on the remote server

Hello,
Try sent the environment variables in ur hosting platform config..so it read the .env files from your hosting...and most time gmail not advisable to use as a mail option u can use sendmail  or mailgun..had same issue when deploying with heroku but I had to use the heroku add-ons mail services and also set the config var in the heroku platform it works.


From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf of Sergei Sokov <sokov.tlt@gmail.com>
Sent: Friday, February 26, 2021 7:09:24 PM
To: Django users <django-users@googlegroups.com>
Subject: Re: Django does't send email on the remote server
 
This code is working
server = smtplib.SMTP('smtp.gmail.com', 587)
    server.starttls()
    server.login('ki@gmail.com', 'pas')
    try:
        server.sendmail('ki@gmail.com', 'so@gmail.com', body_mes.encode('utf-8')) print('ok')
     except:
         print('An error occurred when trying to send an email')

четверг, 25 февраля 2021 г. в 21:53:26 UTC+1, ule...@gmail.com:
i can send email when i use a local server 127.0.0.1:8000 but when i use pythonanywhere.com or eu.pythonanywhere.com 
i can not send mails....

Op donderdag 25 februari 2021 om 21:44:53 UTC+1 schreef Mike Dewhirst:
On 26/02/2021 7:26 am, ule...@gmail.com wrote:
> Any solution ?

You need a friendly sysadmin from your mail provider. Nowadays with so
much spam and botnet activity there are  many email relay checks and
hurdles to deal with. Your remote server has to be established with your
provider and recognised as a bona fide sender.

>
> Op dinsdag 23 februari 2021 om 18:42:42 UTC+1 schreef ule...@gmail.com:
>
> I have this same problem when i use smtp = out.telenet.be
> <http://out.telenet.be>
> on my local server it works fine but when it use
> pythonanywhere.com <http://pythonanywhere.com> i get OSError:
> [Errno 101] Network is unreachable
>
> Op dinsdag 23 februari 2021 om 11:06:09 UTC+1 schreef
> soko...@gmail.com:
>
> I am trying to send an email when a user fills out a form on
> my site.
> Everything works on my local server, letters are sent and I am
> got them.
> On a remote timeweb.com <http://timeweb.com> server with the
> same settings, letters are not sent.
> Tried DEBUG = False and True
> I tried different mail services: gmail, mail, yandex, timeweb
> mail.
> In gmail included "Unreliable applications that have access to
> the account".
> And here I included
> https://accounts.google.com/DisplayUnlockCaptcha
> <https://accounts.google.com/DisplayUnlockCaptcha>
> Nothing helps.
>
> Who knows, please tell me where to dig.
>
> --
> 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
> <mailto:django-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/671d189a-3fc3-426b-a579-18e8f08421b9n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/671d189a-3fc3-426b-a579-18e8f08421b9n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/24577fe3-f08c-446a-9b95-156abced57ccn%40googlegroups.com.

No comments:

Post a Comment