AppendMessage Method


Uploads a message to the specified mailbox on the server.

Messages can be uploaded from files (Option parameter set to 1) or from strings (Option=0). To load message from Message object, use Option=0 and pass Message.RawBody property as a value of Message parameter.


blnResult = ObjectName.AppendMessage(MailboxName, Message, [Date], [Flags], [Options])  
Parameters:  
MailboxName As String Name of the mailbox to upload message to  
Message Message source string. If Options=1, filename of the file containing message source.  
Date As String (optional) If omitted, current date and time will be used. If specified, sets date of the message. Use the following format for this value:

01-Jun-2004 15:52:30 -0500
 
Flags As Long (optional) Defaults to zero. Can be any combination of the following:
  • 1 - Answered
  • 2 - Deleted
  • 4 - Draft
  • 8 - Flagged
  • 16 - Recent
  • 32 - Seen
 
Options As Long (optional) Default to zero. If Options=1, Message parameter points to filename of the file containing message source.  
Return value As Boolean True if successful, False if error has occurred  

Usage example:

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.IMAP4")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.IMAP4")
'In ASP use Response.Write instead of MsgBox

Mailer.EnableLogging = True ' Logging helps to discover any problems
Mailer.LogFilePath = "C:\imap4_log.txt"

Mailer.LicenseKey = "put your license key here"
If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then

  ' Upload message from mail.eml file keeping defaults for datetime and flags
  If Mailer.AppendMessage("Inbox", "C:\mail.eml", , , 1) Then
    MsgBox "Message uploaded successfully"
  End If

  Mailer.Disconnect
Else
  MsgBox Mailer.ErrDesc
End If

See Also:

Message.RawBody Property


Copyright 2002-2010, AfterLogic Corporation. All rights reserved.