Send an email using CDO

xiaoxiao2021-03-06  86

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 [CdoConfiguration.cdoSendEmailAddress] .Value = "/" greystar / ""; conf.Fields [CdoConfiguration.cdoSMTPAuthenticate]. Value = cdoprotocolsauthentication.cdobasic; conf.fields [cdoconfiguration.cdosendusername] .value = "greystar@21cn.com"; conf.fields [cdoconfiguration.cdosendpassword] .value = "xxxxxxx";

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 ();

转载请注明原文地址:https://www.9cbs.com/read-122592.html

New Post(0)