tags:

views:

367

answers:

3

I'm developing a lightweight Gmail client for mobile phones. It access Gmail by IMAP. Then I want to send a draft from the Drafts folder, but it has some attachments and I can't download all of them to send it by SMTP.

Moving/copying it to "Sent Mail" doesn't send it, just moves it to that folder.

How can I send a Draft directly without fetch all the content and attachments from the client? Is there any IMAP command to do it?

Thank you in advance.

+6  A: 

IMAP is a mailbox protocol. It does not (natively) support sending mail, only accessing it. In order to send mail you must use SMTP. Its possible that there is an IMAP extension for sending mail, and its possible that Google Mail supports that extension, but I doubt it. Hence, if you want to send an email with attachments, you must actually have the full content of the message available to you to send.

Jherico
In fact Google Mail doesn't support that "extension". That's why I tried to move the mail to "Sent Mail" box directly.
Ignacio Lago
A: 

Sending email is a special feature of some imap servers. Its nothing in the imap protocol. You just copy your email into a special imap directory on the server and it sends them. I doubt that gmail supports this.

Wienczny
What server(s) support this? I've never heard of this, and would like to investigate it some more.Thanks!
dave wanta
+1  A: 

IMAP was designed to receive email messages, not to send it. There is no IMAP command for sending email AFAIK. There is, however, at least one IMAP server which supports a special 'Outbox' folder. When you place the message into this folder it will be sent automatically.

Check Courier-IMAP documentation on Sending mail via an IMAP connection. Note, that this is a non standard method and I'm not aware of any other server which supports this.

There is a draft for RFC 4468 extending SMTP so it can fetch the mail content from the IMAP server, but I don't know about any working and widely used implementation.

Talking about gmail: sticking with SMTP is probably the safest way to go.

Martin Vobr