Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29929

E-mail sent with smtplib ends as spam

$
0
0

I have the following code:

import smtplib, ssl


def send_email(temperature):
    port = 465  # For SSL
    password = "my_password"
    sender_email = "my_sender@gmail.com"
    receiver_email = "my_receiver@x.y"
    message = """\
    Subject: Temperature is %0.2f degrees C

     """ % temperature

    server = smtplib.SMTP_SSL("smtp.gmail.com", port)
    server.login(sender_email, password)
    server.sendmail(sender_email, receiver_email, message)

if __name__ == "__main__":
    send_email(7.7)

After the first run, the first message was received OK. Next messages were in a spam folder without sender address, subject and body. I tried to mark it as not spam, but it didn't help. The message headers have the correct sender address, subject and body.

Can I correct it somehow?


Viewing all articles
Browse latest Browse all 29929


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