SetFrom

Description

Sets the return address of the mail message.

Note: This method is for VBScript only. It is not available for Perl.

When using a CQMailMsg object to send e-mail:

The CQMailMsg object can be used in a hook, and the hook may execute on a Web server or an installed ClearQuest® client. Since the process identity of these two cases may not be the same, the information available to the mail transport agent (for Windows) or sendmail program (for the UNIX system and Linux) to determine what goes in the From address may be different for these two situations. You can use the SetFrom method to specify a name (such as the return value of the GetUserEmail method of the Session object), but the mail transport agent or sendmail configuration may modify or replace that value.

Note: The SetFrom method has no effect when using MAPI. When sending SMTP e-mail on a Web server, the server name and domain may be included in the "From" part of the message (depending how the sendmail program is configured) instead of the Rational® ClearQuest user e-mail address, unless SetFrom is explicitly used.

Syntax

VBScript

MailMsg.SetFrom returnAddress 
Identifier
Description
MailMsg
A Mail Message object, representing the mail message to be sent.
returnAddress
A String containing the e-mail address to add to the From field of the mail message.
Return value
None.

Examples

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 

Feedback