Name

mail::ACCOUNT::addMessage — Add a message to a folder

Synopsis




#include <libmail/sync.H>

#include <libmail/addmessage.H>

mail::ACCOUNT *mail;

class myAddMessagePull : public mail::addMessagePull {

public:
    std::string getMessageContents();
};

time_t messageDate;
mail::messageInfo newMessageInfo;
myAddMessagePull message;

    message.messageDate=messageDate;
    message.newMessageInfo=newMessageInfo;

bool ok=mail->addMessage( const mail::folder *folder,
  message);
 


std::string errmsg=mail->getErrmsg();

USAGE

This method inserts a message into a folder. folder specifies the folder where the message is added to, which may or may not be the currently open folder.

message's getMessageContents specifies the contents of the message, which should be a valid, MIME-formatted message. getMessageContents does not have to return the entire contents of the message at once. addMessage calls getMessageContents repeatedly. getMessageContents should return the next portion of the message with each call. getMessageContents should return an empty string, after providing the entire message contents are provided. getMessageContents will be called repeatedly until it returns an empty string.

The application may set the following mail::addMessagePull fields before invoking this method. If not initialized, the following fields will be set to their default values.

messageDate

The message's arrival timestamp, which is retrieved by mail::ACCOUNT::getMessageEnvelope(3x), which places it in the arrivalDate field.

Note

This timestamp does not necessarily have to be the same as the timestamp in the message's Date: header.

messageInfo

The message flags, as returned by mail::ACCOUNT::getFolderIndexInfo(3x).

Note

The contents of uid, the message's unique ID, are ignored, only the message flags in messageInfo are read. The message gets automatically assigned a new unique ID when it gets added to the folder.

Return Codes

This method returns true if it succeeds, or false if it fails. If the method fails, use mail::ACCOUNT::getErrmsg() to read a brief description of the error.