ASP CDOSYS ile e-posta gönderme
CDOSYS, ASP'de yerleşik bir bileşendir. Bu bileşen, ASP ile e-posta göndermek için kullanılır.
CDOSYS ile e-posta gönderme
CDO (İşbirliği Veri Nesneleri), mesajlaşma uygulamalarının oluşturulmasını basitleştirmek için tasarlanmış bir Microsoft teknolojisidir.
CDOSYS, ASP'de yerleşik bir bileşendir. ASP ile e-posta göndermek için bu bileşeni nasıl kullanacağınızı göstereceğiz.
CDONT'lara ne dersiniz?
Microsoft, Windows 2000, Windows XP ve Windows 2003'te CDONT kullanımını durdurmuştur. ASP uygulamalarınızda CDONT kullandıysanız, kodu güncellemeli ve yeni CDO teknolojisini kullanmalısınız.
CDOSYS kullanan örnekler
Metin e-postası gönderme:
<%
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 ve CC alanları ile bir metin e-postası gönderme:
<%
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 e-postası gönderme:
<%
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
%>
Bir web sitesinden web sayfası gönderen bir HTML e-postası gönderme:
<%
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "Sending email with CDO"
myMail.From = "[email protected]"
myMail.To ="[email protected]"
myMail.CreateMHTMLBody "https://www.w3schools.com/asp/"
myMail.Send
set myMail = nothing
%>
Bilgisayarınızdaki bir dosyadan web sayfası gönderen bir HTML e-postası gönderme:
<%
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
%>
Ekli bir metin e-postası gönderme:
<%
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
%>
Uzak sunucu kullanarak metin e-postası gönderme:
<%
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
%>