Used script:

import config # typical values for text_subtype are plain, html, xml text_subtype = 'plain' from email.mime.text import MIMEText msg = MIMEText(text, text_subtype) msg['Subject'] = subject msg['From'] = config.sender msg['To'] = config.to_email msg['Cc'] = ', '.join(config.to_cc_emails) from smtplib import SMTP with SMTP(config.smtp_server) as smtp: smtp.set_debuglevel(config.debug_smtp) smtp.starttls() smtp.login(config.username, config.password) smtp.send_message(msg) 

Tested on mail.ru and corporate mail. Simply, if you send a letter through the client or web page of the mail, then the letter sent is there.

Tell me how to send an email script and see it in the outbox.

update. You can get around the problem with a crutch if you send from gmail - it will automatically add the letter to the sent email folder.

  • You understand the mechanism of the mail? Via the web, the mail service tools get into the outbox. Only in this way and nothing else. And there is no such access from the outside and cannot be - maint
  • If I understood, I didn’t ask such questions :) - gil9red
  • this is a client (apple, thunderbird), on the service (mail.ru, gmail), depends on the protocol (SMTP, IMAP). Most services should support IMAP (then only folder names (such as Gmail / Sent) for different services and maybe a couple more settings are needed in order to start supporting a new service). Move an email in GMail with Python and imaplib - jfs
  • @jfs, the wiki says that even though IMAP can send letters, its APPEND command "is considered" unsuccessful "and" insecure ", so SMTP is used for sending, but why is it considered such? In the English version of this article, there is no mention of APPEND at all - gil9red

0