I'm using the following code to send a mail with the certificate. I have a ca-chain.cert.pem file from the mail server. How to use this file for signing mail(I have to use this pem file)?
m_server = {
'username': "abc@myserver.io",
'password': "123435",
'server': "mail.myserver.io",
'port': 465,
}
message = MIMEMultipart("alternative")
message["Subject"] = "Notification"
message["From"] = "abc@myserver.io"
message["To"] = "abc@gmail.com"
email_body = "<p>test</p>"
message.attach(MIMEText(email_body, "html"))
with smtplib.SMTP_SSL(m_server['server'], m_server['port']) as server:
server.set_debuglevel(1)
server.login(m_server['username'], m_server['password'])
server.sendmail(m_server['username'], message["To"], message.as_string())
ca-chain.cert.pem file: this file is related to the mail server
-----BEGIN CERTIFICATE-----
MIIFhTCCA22....
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIFnDCCA4Sg....
-----END CERTIFICATE-----