tags:

views:

22

answers:

2

I am trying to use python's imaplib to create an email and send it to a mailbox with specific name, e.g. INBOX. Anyone has some great suggestion :).

+3  A: 

The IMAP protocol is not designed to send emails. It is designed to manipulate mailboxes.

To create an email and send it you can use SMTP, as in smtplib.

To move an email that is already in a mailbox from one folder to another, you can copy the mail to the needed folder and delete it from the old one using uid, as in the answer here.

Muhammad Alkarouri
thk:), but can i create email in specific mailbox using imaplib?
vernomcrp
@vernomcrp: No, because as I explained imaplib cannot be used to create emails. You can send the email first then move it as above.
Muhammad Alkarouri
A: 

No idea how they do it but doesn't Microsoft Outlook let you move an email from a local folder to a remote IMAP folder?

Ben Scherrey