Najnowsze tutoriale tworzenie stron internetowych
 

ASP Wysyłanie wiadomości e-mail z CDOSYS


CDOSYS jest wbudowany w składnik w ASP. Składnik ten jest używany do wysyłania e-maili z ASP.


Wysyłanie wiadomości e-mail z CDOSYS

CDO (Collaboration Data Objects) to technologia Microsoft, który jest zaprojektowany, aby uprościć tworzenie aplikacji wiadomości.

CDOSYS jest wbudowany w składnik w ASP. Pokażemy Ci, jak korzystać z tego komponentu do wysyłania wiadomości e-mail z ASP.

Jak o CDONTS?

Microsoft zaprzestał używania CDONTS w systemie Windows 2000, Windows XP i Windows 2003. Jeśli korzystałeś CDONTS w aplikacjach ASP, należy zaktualizować kod i wykorzystać nową technologię CDO.

Przykłady w których zastosowano CDOSYS

Wysyłanie SMS e-mail:

<%
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
%>

Wysyłanie SMS e-mail z pola BCC i 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
%>

Wysyłanie wiadomości e-mail w formacie 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
%>

Wysyłanie wiadomości e-mail HTML, który wysyła stronę internetową ze strony internetowej:

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

Wysyłanie wiadomości e-mail HTML, który wysyła stronę z pliku na komputerze:

<%
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
%>

Wysyłanie SMS e-mail z załącznikiem:

<%
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:\mydocuments\test.txt"
myMail.Send
set myMail = nothing
%>

Wysyłanie SMS e-mail za pomocą serwera zdalnego:

<%
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
%>