ImportFromMemory Method


Loads the message from binary block of memory (the data must be in MIME format).


[Visual Basic]

blnResult = ObjectName.ImportFromMemory(Data)

 
Parameters:  
Data As Variant Message MIME data represented as Byte Array.  
Return value As Boolean True if successful, False if error has occurred.  

Usage example:

<%
'  This is ASP-only sample which the message from last uploaded file (it must be in MIME/EML format) without creating any temporary files

Dim Mailer, Uploader, File

' Create new objects
Set Mailer = Server.CreateObject("MailBee.SMTP")
Set Uploader = Server.CreateObject("MailBee.Uploader")

' Specify MailBee license key
Mailer.LicenseKey = "put your license key here"

' Specify the name of the mail server
Mailer.ServerName = "mail.server.com"

' Try to connect to the specified mail server
If Mailer.Connect Then
  ' Get the server's response as a binary array
  Uploader.ParseRequest(Request.BinaryRead(Request.TotalBytes))

  ' Check if the form contains any files
  If (Uploader.FormFiles.Count <> 0) Then
	   ' Select the last file related to the form
	   Set File = Uploader.FormFiles(Uploader.FormFiles.Count)

	   ' Load the email to be sent from the selected file
	   Mailer.Message.ImportFromMemory File.ValueAsArray
  End If

  ' Send the message
  Mailer.Send

  ' Disconnect from the mail server
  Mailer.Disconnect
End If
%>

See Also:

AddMemoryAttachment Method, Uploader Object


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.