MailMsg Object

A MailMsg (OleMailMsg for COM, CQMailMsg for Perl) object represents an e-mail message that you can send to your users.

The MailMsg object can be used to send e-mail messages from an action notification hook or used in an external application. You can use the methods of this object to specify the contents of the e-mail message including the recipients, sender, subject, and body text. You then use the Deliver method of this object to send the e-mail message.

Note: For the e-mail service to function correctly, each HCL Compass user must set up their e-mail options. The IsEmailEnabled method of the Session object can be used to indicate if the user has e-mail enabled or not.

For VBScript, you create a new OleMailMsg object using the CreateObject method as follows:


Dim mailmsg 

Set mailmsg = CreateObject("PAINET.MAILMSG")

For Perl, you create a new CQMailMsg object using the Build method:


$cqmail = CQMailMsg::Build();

# and delete the object when you are done with it:

CQMailMsg::Unbuild($cqmail);

When you have a mail message object, you can:

  • Add recipients using the AddTo, AddCc, and AddBcc methods.
  • Set the return address using the SetFrom method.
  • Add a subject line using the SetSubject method.
  • Set the body text of the e-mail message using the SetBody and MoreBody methods.

For example:


use CQPerlExt;

my $mailmsg = CQMailMsg::Build();

$mailmsg->AddTo("admin@us.ibm.com");

$mailmsg->SetSubject("Howdy");

$mailmsg->SetBody("This message brought to you from cqperl!\n");

$mailmsg->Deliver();

CQMailMsg::Unbuild($mailmsg); 
Note: On the UNIX™ system and Linux™, the Perl CQMailMsg object uses the sendmail program to send the email message. For this to work properly, sendmail must be configured on the UNIX system and Linux client machine.