C
C
cryptoforum2021-06-19 07:49:07
Python
cryptoforum, 2021-06-19 07:49:07

How to restrict sending emails via smtp in Python?

def send_email(from_addr, to_addr, body_text):

    msg_body = ""
    parts = ["From: %s" % from_addr,
            "To: %s" % to_addr,
            "MIME-Version: 1.0",
            "Content-type: text/html",
            "Subject: %s" % subject,
            "",
            body_text
            , "\r\n"]
    msg_body = "\r\n".join(parts)
    server = SMTP(host, 465)
    # server.set_debuglevel(1)
    server.ehlo()
    server.login(usrnme,pswd)
    server.sendmail(from_addr, to_addr, msg_body)
    server.quit()


And sending
send_email("@gmail.com", "@gmail.com", " %s" %(data))


I launch the program, and I receive letters endlessly.
Is it possible to somehow limit it to one letter?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question