0

How do I send a draft mail to draft folder using an API or via imap, SMTP?

mails.on("message", (message, seq) => {
    console.log('message',message);
    message.on("body", stream => {
        console.log("results123456--------",uid);
        let buffer = "";
        stream.on("data", chunk => (buffer += chunk.toString("utf8")));
        stream.once("end", () => mailBox.move(uid, "[Gmail]/Draft")); 
    });
});
E_net4
  • 27,810
  • 13
  • 101
  • 139
nsubhadipta
  • 49
  • 1
  • 7
  • There’s no specific API for this. You download the Draft from IMAP using the normal fetch mechanisms, and then send it via SMTP using the normal SMTP mechanisms. – Max Oct 26 '22 at 15:49
  • i tried but its not working. can you have code or references , how to do – nsubhadipta Nov 10 '22 at 12:18
  • _How_ does it not work? What have you tried? What is your debugging? Were you able to download the message from IMAP in RFC822 format? If so, start with that. – Max Nov 10 '22 at 15:26
  • i tried in node js using nodemailer but its not working. actually question is how to stored the draft mail(create by myself through postman) in mail server through smtp – nsubhadipta Nov 18 '22 at 11:23
  • You do not use SMTP to store a Draft email. You use IMAP's `APPEND` function to create a draft email. You only use SMTP to send emails. When you're ready to send the draft, you download the Draft using the `FETCH` command, modify the headers if necessary, then use SMTP to send it. They are not generally integrated. – Max Nov 18 '22 at 14:52

0 Answers0