SetBody
Description
Sets the body text of the mail message.
This method replaces any existing body text with the string you specify. If you added any body text with previous calls to SetBody method, that text will be lost.
This method does not add end-of-line characters or any other formatting characters when appending the text; you must add these characters yourself to the string you pass in to the bodyText parameter.
Syntax
Perl
$MailMsg->SetBody(bodyText);
- Identifier
- Description
- MailMsg
- A Mail Message object, representing the mail message to be sent.
- bodyText
- A String containing the body text of the mail message.
- Return value
- None.
Example
Perl
use CQPerlExt;
# Session and logon needed if GetUserEmail is used. For example,
# my $sessionObj = CQSession::Build();
# $sessionObj->UserLogon( $loginname, $password, $dbName, "" );
my $mailmsg = CQMailMsg::Build();
# there is currently no SetFrom method for CQPerl
$msg_to = 'admin@us.hcl.com';
$mailmsg->AddTo($msg_to);
# You must log in to a database session if GetUserEmail is used.
$msg_cc = "user_email_address";
# Or this: $msg_cc = $sessionObj->GetUserEmail();
$mailmsg->AddCc($msg_cc);
$msg_subject = "Hello";
$mailmsg->SetSubject($msg_subject);
$msg_body = "This message brought to you from cqperl!\n";
$mailmsg->SetBody($msg_body);
$mailmsg->Deliver();
CQMailMsg::Unbuild($mailmsg);
# CQSession::Unbuild($sessionObj);