Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you send mail using IMAP?

Tags:

smtp

gmail

imap

I am developing a lightweight Gmail client for mobile phones, accessing Gmail by IMAP. I want to send a draft from the Drafts folder, but it has some attachments and I cannot download all of them to send it by SMTP.

Moving/copying it to "Sent Mail" does not send it, just moves it to that folder.

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

like image 435
Ignacio Lago Avatar asked Oct 26 '09 22:10

Ignacio Lago


People also ask

How does IMAP email work?

IMAP allows you to access your email wherever you are, from any device. When you read an email message using IMAP, you aren't actually downloading or storing it on your computer; instead, you're reading it from the email service.

What email uses IMAP?

In short, IMAP is the protocol that email clients like Mail. app, Thunderbird, and Mailspring use to download messages from your email account and to make changes like archiving messages or sorting them into folders.

Is IMAP for sending or receiving?

What Is IMAP? The Internet Message Access Protocol, also known as IMAP, is a protocol for receiving emails from a server. Since IAMP allows access to emails from multiple locations simultaneously, it keeps the email on the server after being delivered.


2 Answers

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.

like image 72
Jherico Avatar answered Oct 04 '22 10:10

Jherico


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 RFC 4468 which extends 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.

like image 26
Martin Vobr Avatar answered Oct 04 '22 11:10

Martin Vobr