Merhaba arkadaşlar.Bir yerden vb.net mail gonderme kodları buldum.
Fakat bunu vb.net 2010 a ceviremedim.Yardımcı olursanız minnettar kalırım.Saygılarımla...
Kod :
Kod:
Option Explicit Private Response As String Sub SendEmail(ServerDomain As String, FromEmail As String, ToEmail As String, Subject As String, Body As String) w.LocalPort = 0 If w.State sckClosed Then w.Close w.Protocol = sckTCPProtocol w.RemoteHost = ServerDomain w.RemotePort = 25 w.Connect WaitForResponse ("220") w.SendData "HELO " & ServerDomain & vbCrLf WaitForResponse ("250") w.SendData "MAIL FROM: " & vbCrLf WaitForResponse ("250") 'wait for response w.SendData "RCPT TO: " & vbCrLf WaitForResponse ("250") 'wait for response w.SendData ("data" & vbCrLf) WaitForResponse ("354") w.SendData "From: " & FromEmail & vbCrLf w.SendData "X-Mailer: BASTON SMTP Mailer" & vbCrLf w.SendData "To: " & ToEmail & vbCrLf w.SendData "Subject: " & Subject & vbCrLf w.SendData Body & vbCrLf w.SendData "." & vbCrLf WaitForResponse ("250") w.SendData "quit" & vbCrLf WaitForResponse ("221") w.Close MsgBox "Mesajınız başarıyla gonderildi.", vbExclamation, "Mesajını Gonderildi." End Sub Sub WaitForResponse(ResponseCode As String) Dim Reply As Integer Dim Start As Single Dim Tmr As Single Start = Timer While Len(Response) = 0 Tmr = Start - Timer DoEvents If Tmr > 10 Then MsgBox "Hata:" + vbCrLf + "İşlem zamanaşımına uğradı!", vbExclamation, "İşlem Başarısız" Exit Sub End If Wend While Left(Response, 3) ResponseCode DoEvents If Tmr > 10 Then MsgBox "Hata:" + vbCrLf + "Gecersiz bir yanıt alındı: " + Response + vbCrLf + "Expected code: " + ResponseCode, vbExclamation, "İşlem Başarısız." Exit Sub End If Wend Response = "" End Sub Private Sub cmdExit_Click() Unload Me End End Sub Private Sub cmdSend_Click() SendEmail txtServerDomain, txtFromEmail, txtToEmail, txtSubject, txtMessage End Sub Private Sub w_DataArrival(ByVal bytesTotal As Long) w.GetData Response End Sub
__________________
2005'ten 2010'a Kod Ceviri
Programlama0 Mesaj
●27 Görüntüleme
- ReadBull.net
- Programlama ve Yazılım
- Programlama
- 2005'ten 2010'a Kod Ceviri