Skip to main content

AccessTr.neT


Access'ten mail gönderme

Access'ten mail gönderme

#2
arkadaşlar siteden bulduğum Seruz arkadaşın ürünü şu kod muhteşem. Excel tablosuna gerek kalmadan ihtiyacımı giderdi şimdilik. Fakat bu kod, altformumda bulunan tek bir kayda ilişkin verileri gönderiyor. Ben hepsinin gönderilmesini istiyorum.
Faydalanmak isteyenler için ekleyeyim.


Kod:
Private Sub btn_EPOSTA_Click()
   If IsNull(Me.eposta) Then
       MsgBox "E-posta adresi yok!", vbCritical, "Hata oluştu."
   Else
       ePOSTA_Gonder
   End If
End Sub

Private Sub ePOSTA_Gonder()
On Error GoTo Hata
'---------------------------------------------------------------
Const cdoAnonymous = 0
Const cdoBasic = 1
Const cdoNTLM = 2
Dim objMessage As Object
Dim SMTP_Sunucu, Gonderenin_Mail_Adresi, Gonderenin_Mail_Sifresi, Gonderilecek_Mail_Adresi, strBody
'---------------------------------------------------------------
SMTP_Sunucu = "smtp.xxxx.xxx.tr"
Gonderenin_Mail_Adresi = "[email protected]"
Gonderenin_Mail_Sifresi = ""
Gonderilecek_Mail_Adresi = Me.eposta
If Gonderenin_Mail_Adresi = "" Or Gonderenin_Mail_Sifresi = "" Or Gonderilecek_Mail_Adresi = "" Then
   MsgBox "Bilgileriniz eksik olduğu için e-posta gönderilemiyor !", vbCritical, "Hata oluştu."
   Exit Sub
End If
'---------------------------------------------------------------
strBody = ""
strBody = strBody & " Sn. " & Me.adısoyadı
strBody = strBody & " Kesintiniz : " & Me.kesinti
strBody = strBody & " Maaş Tutarınız : " & Me.maas_tutar
'---------------------------------------------------------------
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Örnek E-Posta"
objMessage.From = Gonderenin_Mail_Adresi
objMessage.To = Gonderilecek_Mail_Adresi
objMessage.HTMLBody = strBody
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = Gonderenin_Mail_Adresi
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = Gonderenin_Mail_Sifresi
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_Sunucu
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
objMessage.Send
MsgBox "İlgili kişiye e-posta gönderilmiştir.", vbInformation, "İşlem tamam"
Exit Sub
'---------------------------------------------------------------
Hata:
   MsgBox "E-posta gönderimi başarısız oldu!", vbCritical, "Hata oluştu."
End Sub

Son Düzenleme: 22/12/2015, 17:47, Düzenleyen: mehmetb84.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Access'ten mail gönderme - Yazar: mehmetb84 - 22/12/2015, 16:32
Cvp: Access'ten mail gönderme - Yazar: mehmetb84 - 22/12/2015, 17:19
Cvp: Access'ten mail gönderme - Yazar: ozanakkaya - 22/12/2015, 20:28
Cvp: Access'ten mail gönderme - Yazar: mehmetb84 - 23/12/2015, 11:43
Cvp: Access'ten mail gönderme - Yazar: ozanakkaya - 24/12/2015, 21:17
Cvp: Access'ten mail gönderme - Yazar: mehmetb84 - 25/12/2015, 12:10
Cvp: Access'ten mail gönderme - Yazar: ozanakkaya - 27/12/2015, 04:20
Cvp: Access'ten mail gönderme - Yazar: mehmetb84 - 27/12/2015, 15:15
Cvp: Access'ten mail gönderme - Yazar: ozanakkaya - 30/12/2015, 00:37
Cvp: Access'ten mail gönderme - Yazar: mehmetb84 - 30/12/2015, 12:01
Task