Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23390

Not Able to send mail with certificate in FASTAPI -

$
0
0

Error Getting :

  1. Send mail:

    Exception raised [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1135),

    check your credentials or email service configuration

  2. Send mail:

    [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)

....

    ** context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)     context.load_cert_chain(certfile="./cert/mail-apps_hub.pem")**    with smtplib.SMTP_SSL(conf.MAIL_SERVER, conf.MAIL_PORT, context=context) as server:        server.login(conf.MAIL_USERNAME, conf.MAIL_PASSWORD)        for email in emails:            try:                email.topic = topic                message = MessageSchema(                    recipients=[email.sent_to],                    subject=email.subject,                    template_body=email.body                )                template_name = ''                if topic == 'user_activate':                    template_name = 'user_activate.html'                if topic == 'requirement_allocation':                    template_name = 'requirements.html'                if topic == 'requirement_rejected':                    template_name = 'requirement_try.html'                if template_name == '':                    raise Exception("Template name is empty")                # send the email                fm = FastMail(conf)                await fm.send_message(message, template_name)            except Exception as ex:                print(f"Send mail:{ex}")

Please check the code and provide me correct code


Viewing all articles
Browse latest Browse all 23390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>