Gönderen Konu: Tüm Bileşenlerle Asp İle Mail  (Okunma sayısı 1758 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı Yasin_0023

  • İleti: 157
  • Puan: 148
  • Cinsiyet: Bay
    • SİYAHSERİT
Tüm Bileşenlerle Asp İle Mail
« : Aralık 14, 2008, 22:25:40 ÖS »
Asp ile Mail Atmak İçin Tüm bileşenlere örnek kod

Jmail, aspmail, cdo, cdonts ve smtp mailserver  componenetleri ile mail gönderme hakkında gelişmiş bir kod örneği.

Kod: [Seç]
<%

'########################
Sub  SendMail(SendTo,From,ReplyTo,Subject,Body,Attachments)

MailComponent="cdo"'### Defines which email component  to  use. Valid values are: "jmail", "aspmail", "cdo" or "cdonts" (Note: cdonts only works  with  the local server, SMTPMailServer is ignored! CDO has problems on some servers.).
MailServer="localhost"'### SMTP Mailserver  to  be used  to  send account information  to  users.

SenderIp=Request.ServerVariables("HTTP_X_FORWARDED_FOR")'Sender ip



' ### Send mail  with  jmail
If  LCase(MailComponent="jmail")  Then 
     Set  Msg = Server.CreateObject( "JMail.Message" )
    Msg.ISOEncodeHeaders =  false
    Msg.AddRecipient SendTo
     If  ReplyTo<>""  Then  Msg.ReplyTo = ReplyTo
    Msg.From = From
    Msg.Subject = Subject
    Msg.Body = Body
    If  IsArray(Attachments)  Then
         For  i = 0 To  Ubound(Attachments)
            Msg.AddAttachment Attachments(i)
         Next
     End  If
    Msg.AddHeader "Originating-IP", SenderIp
    Msg.send(MailServer)
    Msg.close
     Set  Msg=Nothing

' ### Send mail  with  AspMail
ElseIf  LCase(MailComponent="aspmail")  Then
     Set  Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromAddress = From
    Mailer.AddRecipient SendTo,SendTo
     If  ReplyTo<>""  Then  Mailer.ReplyTo = ReplyTo
    Mailer.Subject = Subject
    Mailer.BodyText = Body
    If  IsArray(Attachments)  Then
         For  i = 0 To  Ubound(Attachments)
            Mailer.AddAttachment Attachments(i)
         Next
     End  If
    Mailer.AddExtraHeader "Originating-IP: " & SenderIp
    Mailer.RemoteHost = MailServer
    SentOK=Mailer.SendMail
     Set  Mailer=Nothing

' ### Send mail  with  Cdonts
ElseIf  LCase(MailComponent="cdonts")  Then
     Set  objNewMail = Server.CreateObject("CDONTS.NewMail")
    objNewMail.From = From
     If  ReplyTo<>""  Then  objNewMail.Value("Reply-To") = ReplyTo
    objNewMail.Value("Originating-IP") = SenderIp
    objNewMail.To = SendTo
    objNewMail.Subject =Subject
    objNewMail.Body = Body
    objNewMail.BodyFormat=1
    objNewMail.MailFormat=0
    If  IsArray(Attachments)  Then
         For  i = 0 To  Ubound(Attachments)
            objNewMail.AttachFile Attachments(i)
         Next
     End  If
    objNewMail.Send
     Set  objNewMail =  Nothing

' ### Send mail  with  Cdo
ElseIf  LCase(MailComponent="cdo")  Then
     Set  cdoConfig = Server.CreateObject("CDO.Configuration")
    sch = "http://schemas.microsoft.com/cdo/configuration/"
    cdoConfig.Fields.Item(sch & "sendusing") = 2
    cdoConfig.Fields.Item(sch & "smtpserver") = MailServer
    'cdoConfig.Fields.Item(sch & "authenticate") = 2 'Type of authentication, NONE, Basic (Base64 encoded), NTLM
    'cdoConfig.Fields.Item(sch & "sendusername") = "username"
    'cdoConfig.Fields.Item(sch & "sendpassword") = "parolam"
    cdoConfig.Fields.Item(sch & "smtpserverport") = 25
    'cdoConfig.Fields.Item(sch & "smtpusessl") =  False
    cdoConfig.fields.update
      Set  objNewMail = Server.CreateObject("CDO.Message")
     Set  objNewMail.Configuration = cdoConfig
    objNewMail.From= From
    objNewMail.To= SendTo
    objNewMail.ReplyTo= ReplyTo
    'objNewMail.Cc= SendTo
    'objNewMail.Bcc= SendTo
    objNewMail.Subject=Subject
    objNewMail.TextBody=Body
    'objNewMail.HtmBody = "<h1>Thtml</h1>"
    'objNewMail.HtmBody = "file://c|/temp/test.htm"
    'objNewMail.HtmBody = "http://www.smslust.net"

    If  IsArray(Attachments)  Then
         For  i = 0 To  Ubound(Attachments)
            objNewMail.AddAttachment Attachments(i)
         Next
     End  If
    objNewMail.Send
     Set  objNewMail =  Nothing 
End  If
End  Sub



SendTo="a@dd.com"
From="noreply@prowww.net"
ReplyTo="sss@dd.com"
Subject="Selam"
Body="Test"
SendMail SendTo,From,ReplyTo,Subject,Body,Attachments

%>
Konuyu Paylaş:
  delicious  facebook  twitter  google
|www .siyahserit.tr.cx | 
|www .siyahserit.tr.gg  |  |www.uzmanweb.yetkinblog.com |  |www.uzmanweb.yetkinforum.com | |www.siyahserit.turkforumpro.com  |

Çevrimdışı azizim

  • İleti: 1
  • Puan: 0
-Tüm Bileşenlerle Asp İle Mail
« Yanıtla #1 : Ocak 31, 2011, 16:05:19 ÖS »
ilk sayfa nerede?

Çevrimdışı burajan

  • Web Programcısı
  • Administrator
  • *
  • İleti: 5109
  • Puan: 334
  • Cinsiyet: Bay
  • Web Programcısı
    • Burak ŞİMŞEK - Kişisel İnternet Sitesi
-Tüm Bileşenlerle Asp İle Mail
« Yanıtla #2 : Ocak 31, 2011, 18:07:43 ÖS »
Bu kodda ilk sayfa kullanılmamış ama kod içerisinde kodların sonunda şöyle bir kod belirtilmiş:
Kod: [Seç]
SendTo="a@dd.com"
From="noreply@prowww.net"
ReplyTo="sss@dd.com"
Subject="Selam"
Body="Test"
Bilgiler buraya yazılabilir yada ilk sayfa yapılarak buraya işlenmesi sağlanabilir.
Kişisel İnternet Sitem => buraksimsek.com.tr - http://www.buraksimsek.com.tr

Lütfen özel mesaj ile destek istemeyiniz. Önce forumda arama yapınız daha sonra forumda ilgili bölüme konu açınız.

 

Benzer Konular

  Konu / Başlatan Yanıt Son İleti
0 Yanıt
1246 Gösterim
Son İleti Nisan 05, 2007, 21:30:16 ÖS
Gönderen: 17632
0 Yanıt
1269 Gösterim
Son İleti Ağustos 24, 2008, 08:46:21 ÖÖ
Gönderen: Yasin_0023
1 Yanıt
2047 Gösterim
Son İleti Aralık 22, 2009, 08:53:03 ÖÖ
Gönderen: jesuwa
3 Yanıt
867 Gösterim
Son İleti Şubat 28, 2009, 18:17:18 ÖS
Gönderen: AdmiN
2 Yanıt
787 Gösterim
Son İleti Aralık 14, 2009, 23:40:34 ÖS
Gönderen: 17632