Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

メールの作成

次に、MailMessage オブジェクトを生成し、その FromTo、および Subject の各プロパティに値を入力します。

ここでは、“To” のアドレスを直接指定せずに Msg.To.Insert メソッドを呼び出して、アドレスを設定します。繰り返しこのメソッドを呼び出して、複数の受信者にメッセージを送信できます。

(個人のコンピュータの場合、Email アドレスを "**Address**" に置き換えます。)

—Utils.SendEmail—
Utils.SendEmail
ClassMethod SendEmail(Address As %String, MessageText As %String)
{
    // Create an SMTP object and connect to a server
    Set Mailer = ##class(%Net.SMTP).%New()

    // Fill in the name of your mail server
    Set Mailer.smtpserver = "**Server**"

    // Create a Message object and fill in From, To, Subject
    Set Msg = ##class(%Net.MailMessage).%New()
    Set Msg.From="**Address**"
    Do Msg.To.Insert(Address)
    Set Msg.Subject = "Theater Tickets"
}
FeedbackOpens in a new tab