SetBody

Descrizione

Imposta il testo del messaggio di posta.

Questo metodo sostituisce qualsiasi testo esistente con la stringa specificata. Se un testo è stato aggiunto con le precedenti chiamate al metodo SetBody o MoreBody, tale testo verrà perso.

Questo metodo non aggiunge caratteri di fine riga o qualsiasi altro carattere per la formattazione durante l'aggiunta del testo; è necessario aggiungere tali caratteri alla stringa trasmessa nel parametro bodyText

Sintassi

VBScript

MailMsg.SetBody bodyText 

Perl

$MailMsg->SetBody(bodyText); 
Identificativo
Descrizione
MailMsg
Un oggetto Mail Message, che rappresenta il messaggio di posta da inviare.
bodyText
Una stringa che contiene il testo del messaggio di posta.
Valore di ritorno
Nessuno.

Esempi

VBScript

Dim OleMailMsg

' Session and logon needed if GetUserEmail is used. For example, 
' Dim sessionObj
' Set sessionObj = GetSession
' sessionObj.UserLogon loginname, password, dbName, AD_PRIVATE_SESSION, ""

Set OleMailMsg = CreateObject("PAINET.MAILMSG")

msg_from = "admin@example.com"
OleMailMsg.SetFrom(msg_from)

msg_to = "admin@example.com"
OleMailMsg.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
OleMailMsg.AddCc(msg_cc)

msg_subject = "Hello"
OleMailMsg.SetSubject(msg_subject)

msg_body = "This message brought to you from cqole!\n"
OleMailMsg.SetBody(msg_body)

OleMailMsg.Deliver 

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

Feedback