Latest web development tutorials

ASPは、電子メールを送信するためにCDOSYSを使用しています

CDOSYSはASPに組み込まれているコンポーネントです。 このコンポーネントは、ASPを介して電子メールを送信するために使用されます。


電子メールを送信するためにCDOSYSを使用して、

CDO(コラボレーションデータオブジェクト)は、通信アプリケーションの作成を簡素化するために設計されたMicrosoftの技術です。

CDOSYSはASPに組み込まれているコンポーネントです。 私たちは、電子メールを送信するコンポーネントのASPを使用する方法を紹介します。

CDONTSか?

マイクロソフトは、Windows 2000、Windows XPおよびWindows 2003が除去されているCDONTSを持っています。 あなたは既にCDONTSにASPアプリケーションを使用する場合は、コードを更新し、新たなCDOの技術を使用する必要があります。

CDOSYSの例

電子メールのテキストを送信します。

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>

BccのとCCフィールドにテキストメールを送信:

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.Bcc="[email protected]"
myMail.Cc="[email protected]"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>

HTML形式の電子メールを送信:

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.HTMLBody = "<h1>This is a message.</h1>"
myMail.Send
set myMail=nothing
%>

サイトのHTML形式の電子メールのページの内容を送信します:

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.CreateMHTMLBody "http://www.w3cschool.cc/asp/"
myMail.Send
set myMail=nothing
%>

HTML形式の電子メール内のファイルでコンピュータ上のページの内容を送信します:

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.CreateMHTMLBody "file://c:/mydocuments/test.htm"
myMail.Send
set myMail=nothing
%>

添付ファイル付きのテキストメールを送信:

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.TextBody="This is a message."
myMail.AddAttachment "c:mydocumentstest.txt"
myMail.Send
set myMail=nothing
%>

電子メールのテキストを送信するために、リモートサーバーを使用します。

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.TextBody="This is a message."
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>