BodyText Property

This property specifies current email body text.


Data Type: String


Remarks

Specify the main body text of email message.

Email body text is formatted according to the setting of BodyFormat property.

To facilitate addition of large amounts of text to the message, you may use ImportMail() method. This method fills BodyText property with content from specified file.

Usage Example:

[Visual Basic]
    
Private Sub SendEmail()
  Dim oSmtp As EASendMailObjLib.Mail
  Set oSmtp = New EASendMailObjLib.Mail

  'The license code for EASendMail ActiveX Object, 
  'for evaluation usage, please use "TryIt" as the license code.
  oSmtp.LicenseCode = "TryIt"
  
  oSmtp.ServerAddr = "mail.adminsystem.net"
  
  'If your server require user authentication 
  'oSmtp.UserName = "test@adminsystem.net"
  'oSmtp.Password = "test"
  
  'If your server requires SSL connection 
  'oSmtp.SSL_init 
  'oSmtp.SSL_starttls = 0 
  'oSmtp.ServerPort = 465
  
  ''If your server requires TLS connection 
  'oSmtp.SSL_init 
  'oSmtp.SSL_starttls = 1 
  'oSmtp.ServerPort = 25
  
  oSmtp.FromAddr = "test@adminsystem.net"
  oSmtp.AddRecipient "Support Team", "support@adminsystem.net", 0

  oSmtp.BodyFormat = 1 'html email body
  oSmtp.Subject = "Test"
  oSmtp.BodyText = "<html>..<body>Hello, this is a test...."
 
  If oSmtp.SendMail() = 0 Then
    MsgBox "Message delivered!"
  Else
    MsgBox oSmtp.GetLastErrDescription()
  End If
End Sub

[Visual C++]
#include "stdafx.h"
#include <comdef.h>
#include <iostream>
#include "easendmailobj.tlh"
using namespace EASendMailObjLib;
using namespace std;

void SendEmail()
{
  ::CoInitialize( NULL );
  IMailPtr oSmtp = NULL;
  oSmtp.CreateInstance("EASendMailObj.Mail");
 //The license code for EASendMail ActiveX Object, 
  //for evaluation usage, please use "TryIt" as the license code.
  oSmtp->LicenseCode = _bstr_t("TryIt");

  oSmtp->ServerAddr = _bstr_t( "mail.adminsystem.net" );
  //If your server require user authentication 
  //oSmtp->UserName = _bstr_t("test@adminsystem.net"); 
  //oSmtp->Password = _bstr_t("test");
  
  //If your server requires SSL connection 
  //oSmtp->SSL_init();
  //oSmtp->SSL_starttls = 0; 
  //oSmtp->ServerPort = 465;
  
  //If your server requires TLS connection 
  //oSmtp->SSL_init();
  //oSmtp->SSL_starttls = 1; 
  //oSmtp->ServerPort = 25;  	

  oSmtp->FromAddr = _bstr_t( "test@adminsystem.net" );
  oSmtp->AddRecipient( _bstr_t("Support Team"), 
                          _bstr_t("support@adminsystem.net"), 0 );

  oSmtp->BodyFormat = 1; //html email body
  oSmtp->Subject = _bstr_t("Test");
  oSmtp->BodyText = _bstr_t("<html>..<body>Hello, this is a test....");
  
  if( oSmtp->SendMail() == 0 )
    cout << "Message delivered!" << endl;
  else
    cout << (const char*)(oSmtp->GetLastErrDescription()) << endl;
}

See Also

BodyFormat Property
Charset Property
ImportMail Method
ConvertHTML Method