Reference CDO components, cdosys under System32. DLL, add a packager
Using CDO;
// This example uses CDO to implement send mail, can be verified, this example sends mail to the external network in the active directory Successfully Professional2k Office2k Office2k3 vs2, 2, vs2k3, to reference CDOSYS Configuration Conf = New Configuration (); // The following sections set parameters (server, terminal, user name, password, send mail account, reply) conf.fields [cdoconfiguration.cdosendusingMethod] .value = cdosendusing.cdosendusingport; conf.fields [cdoconfiguration.cdosmtpserver] .value = " smtp.21cn.com "; conf.Fields [CdoConfiguration.cdoSMTPServerPort] .Value = 25; conf.Fields [CdoConfiguration.cdoSMTPAccountName] .Value =" greystar@21cn.com "; conf.Fields [CdoConfiguration.cdoSendUserReplyEmailAddress] .Value = "/" greystar / "
Conf.fields.Update (); MessageClass msg = new messageclass ();
Msg.configuration = conf; msg.to = "greystar@21cn.com"; msg.subject = "Registration Confirmation Notification"; msg.htmlbody = "Registration Information" msg.from = "GreyStar@21cn.com";
Msg.send ();