MailMsg Object

A MailMsg (CQMailMsg) 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.

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 method.

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);