ImportFromFile Method


Loads and parses an e-mail message from a disk file.

The file must contain RFC822-compliant message (such files usually have ".eml" extension). SaveMessage method of the Message object saves files in this format.

Note: To "blind-forward" (resend without modifications) previously saved message it's better to use RelayMessage method of the SMTP object.


blnResult = ObjectName.ImportFromFile(FilePath)  
Parameters:  
FilePath As String The path to the file to load  
Return value As Boolean True if successful. False if error has occurred (file not found, i/o error, etc.)  

Usage example:

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.SMTP")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.SMTP")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.ServerName = "mail.server.com"
If Mailer.Connect Then
  Mailer.Message.ImportFromFile "C:\docs\letter.eml"

  ' Add some modifications to the message (otherwise RelayMessage would be enough)
  Mailer.Subject = "FW:" & Mailer.Subject

  Mailer.Send
  Mailer.Disconnect
End If

See Also:

SMTP.Send Method
SMTP.RelayMessage Method


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